mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Updated with a little infrastructure for allowing daemonization.
This commit is contained in:
parent
4e5f79ebe5
commit
437afe707c
21
src/conf.py
21
src/conf.py
@ -46,6 +46,18 @@ installDir = os.path.dirname(os.path.dirname(sys.modules[__name__].__file__))
|
||||
_srcDir = os.path.join(installDir, 'src')
|
||||
_pluginsDir = os.path.join(installDir, 'plugins')
|
||||
|
||||
###
|
||||
# version: This should be pretty obvious.
|
||||
###
|
||||
version ='0.77.2'
|
||||
|
||||
###
|
||||
# daemonized: This determines whether or not the bot has been daemonized
|
||||
# (i.e., set to run in the background). Obviously, this defaults
|
||||
# to False.
|
||||
###
|
||||
daemonized = False
|
||||
|
||||
###
|
||||
# allowEval: True if the owner (and only the owner) should be able to eval
|
||||
# arbitrary Python code. This is specifically *not* a registry
|
||||
@ -484,13 +496,4 @@ variable."""))
|
||||
|
||||
supybot.register('plugins') # This will be used by plugins, but not here.
|
||||
|
||||
###############################
|
||||
###############################
|
||||
###############################
|
||||
# DO NOT EDIT PAST THIS POINT #
|
||||
###############################
|
||||
###############################
|
||||
###############################
|
||||
version ='0.77.2'
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
15
src/log.py
15
src/log.py
@ -82,7 +82,7 @@ class StdoutStreamHandler(BetterStreamHandler):
|
||||
logging._releaseLock()
|
||||
|
||||
def emit(self, record):
|
||||
if conf.supybot.log.stdout():
|
||||
if conf.supybot.log.stdout() and not conf.daemonized:
|
||||
try:
|
||||
BetterStreamHandler.emit(self, record)
|
||||
except ValueError, e: # Raised if sys.stdout is closed.
|
||||
@ -278,12 +278,13 @@ _handler.setLevel(-1)
|
||||
_logger.addHandler(_handler)
|
||||
_logger.setLevel(conf.supybot.log.level())
|
||||
|
||||
_stdoutHandler = StdoutStreamHandler(sys.stdout)
|
||||
_formatString = '%(name)s: %(levelname)s %(message)s'
|
||||
_stdoutFormatter = ColorizedFormatter(_formatString)
|
||||
_stdoutHandler.setFormatter(_stdoutFormatter)
|
||||
_stdoutHandler.setLevel(-1)
|
||||
_logger.addHandler(_stdoutHandler)
|
||||
if not conf.daemonized:
|
||||
_stdoutHandler = StdoutStreamHandler(sys.stdout)
|
||||
_formatString = '%(name)s: %(levelname)s %(message)s'
|
||||
_stdoutFormatter = ColorizedFormatter(_formatString)
|
||||
_stdoutHandler.setFormatter(_stdoutFormatter)
|
||||
_stdoutHandler.setLevel(-1)
|
||||
_logger.addHandler(_stdoutHandler)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user