log-server,v
来自「Perfession Linux Programming examples」· 代码 · 共 57 行
TXT
57 行
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 + =
减小字号Ctrl + -
显示快捷键?