⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 log-server,v

📁 Perfession Linux Programming examples
💻
字号:
head	1.1;
access;
symbols;
locks
	cbbrowne:1.1; strict;
comment	@# @;


1.1
date	2000.06.25.02.29.53;	author cbbrowne;	state Exp;
branches;
next	;


desc
@Logging Server
@


1.1
log
@Initial revision
@
text
@#!/usr/bin/env python
# $ID$
import CORBA, sys, regex, string, random, time
from string import split, strip, joinfields
from time import localtime, strftime, time
# Here are the functions to support the LOG interface
class LOG:   # interface
    def addlog (self, info):
	logfile = open("./logs.log", "a")
	logfile.write(joinfields([info.hostname,
				  strftime("%Y/%m/%d %H:%M:%S %Z", 
					   localtime(time())), 
				  info.userid, info.application,
				  info.messagetype, info.shortmessage], "|"))
	logfile.write("\n")
	logfile.close()

CORBA.load_idl("logger.idl")
orb = CORBA.ORB_init((), CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")

servant = POA.LOG.LOG(LOG())
poa.activate_object(servant)
ref = poa.servant_to_reference(servant)
open("./logger.ior", "w").write(orb.object_to_string(ref))

## Let's see about submitting the IOR to the Name Service

print "Done initialization: Proceed!"
poa.the_POAManager.activate()
orb.run()
@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -