📄 log-server.py,v
字号:
head 1.1;
access;
symbols;
locks
cbbrowne:1.1; strict;
comment @# @;
1.1
date 2000.07.27.04.51.35; author cbbrowne; state Exp;
branches;
next ;
desc
@@
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))
print "Done initialization: Proceed!"
poa.the_POAManager.activate()
orb.run()
@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -