mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-30 04:16:49 +02: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')
|
_srcDir = os.path.join(installDir, 'src')
|
||||||
_pluginsDir = os.path.join(installDir, 'plugins')
|
_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
|
# allowEval: True if the owner (and only the owner) should be able to eval
|
||||||
# arbitrary Python code. This is specifically *not* a registry
|
# 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.
|
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:
|
# 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()
|
logging._releaseLock()
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
if conf.supybot.log.stdout():
|
if conf.supybot.log.stdout() and not conf.daemonized:
|
||||||
try:
|
try:
|
||||||
BetterStreamHandler.emit(self, record)
|
BetterStreamHandler.emit(self, record)
|
||||||
except ValueError, e: # Raised if sys.stdout is closed.
|
except ValueError, e: # Raised if sys.stdout is closed.
|
||||||
@ -278,12 +278,13 @@ _handler.setLevel(-1)
|
|||||||
_logger.addHandler(_handler)
|
_logger.addHandler(_handler)
|
||||||
_logger.setLevel(conf.supybot.log.level())
|
_logger.setLevel(conf.supybot.log.level())
|
||||||
|
|
||||||
_stdoutHandler = StdoutStreamHandler(sys.stdout)
|
if not conf.daemonized:
|
||||||
_formatString = '%(name)s: %(levelname)s %(message)s'
|
_stdoutHandler = StdoutStreamHandler(sys.stdout)
|
||||||
_stdoutFormatter = ColorizedFormatter(_formatString)
|
_formatString = '%(name)s: %(levelname)s %(message)s'
|
||||||
_stdoutHandler.setFormatter(_stdoutFormatter)
|
_stdoutFormatter = ColorizedFormatter(_formatString)
|
||||||
_stdoutHandler.setLevel(-1)
|
_stdoutHandler.setFormatter(_stdoutFormatter)
|
||||||
_logger.addHandler(_stdoutHandler)
|
_stdoutHandler.setLevel(-1)
|
||||||
|
_logger.addHandler(_stdoutHandler)
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user