semi-fixed logging
This commit is contained in:
parent
43d4d282f7
commit
99c227ffc7
1 changed files with 5 additions and 2 deletions
|
@ -3,6 +3,7 @@ log.py: written by Scaevolus 2009
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import codecs
|
import codecs
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
@ -88,7 +89,7 @@ def get_log_fd(dir, server, chan):
|
||||||
return fd
|
return fd
|
||||||
|
|
||||||
|
|
||||||
@hook.singlethread
|
#@hook.singlethread
|
||||||
@hook.event('*')
|
@hook.event('*')
|
||||||
def log(paraml, input=None, bot=None):
|
def log(paraml, input=None, bot=None):
|
||||||
timestamp = gmtime(timestamp_format)
|
timestamp = gmtime(timestamp_format)
|
||||||
|
@ -110,4 +111,6 @@ def log(paraml, input=None, bot=None):
|
||||||
fd = get_log_fd(bot.data_dir, input.server, input.chan)
|
fd = get_log_fd(bot.data_dir, input.server, input.chan)
|
||||||
fd.write(timestamp + ' ' + beau + '\n')
|
fd.write(timestamp + ' ' + beau + '\n')
|
||||||
|
|
||||||
print timestamp, input.chan, beau.encode('utf8', 'ignore')
|
out = "{} {} {}".format(timestamp, input.chan, beau.encode('utf8', 'ignore'))
|
||||||
|
|
||||||
|
sys.stdout.write(out + os.linesep)
|
||||||
|
|
Reference in a new issue