Moving the logging system to src/
This commit is contained in:
parent
5064d0cacc
commit
ff98ede98f
6 changed files with 17 additions and 17 deletions
|
|
@ -3,7 +3,7 @@ Custom manager for ConfigValue objects.
|
||||||
"""
|
"""
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
from django.db import models
|
from django.db import models
|
||||||
import functions_log
|
from src import logger
|
||||||
|
|
||||||
class ConfigValueManager(models.Manager):
|
class ConfigValueManager(models.Manager):
|
||||||
def get_configvalue(self, configname):
|
def get_configvalue(self, configname):
|
||||||
|
|
@ -13,7 +13,7 @@ class ConfigValueManager(models.Manager):
|
||||||
try:
|
try:
|
||||||
return self.get(conf_key__iexact=configname).conf_value
|
return self.get(conf_key__iexact=configname).conf_value
|
||||||
except self.model.DoesNotExist:
|
except self.model.DoesNotExist:
|
||||||
functions_log.log_errmsg("Unable to get config value for %s (does not exist):\n%s" % (
|
logger.log_errmsg("Unable to get config value for %s (does not exist):\n%s" % (
|
||||||
configname, (format_exc())))
|
configname, (format_exc())))
|
||||||
|
|
||||||
def set_configvalue(self, configname, newvalue):
|
def set_configvalue(self, configname, newvalue):
|
||||||
|
|
@ -28,5 +28,5 @@ class ConfigValueManager(models.Manager):
|
||||||
# We'll do this instead of conf.conf_value, might save a DB query.
|
# We'll do this instead of conf.conf_value, might save a DB query.
|
||||||
return newvalue
|
return newvalue
|
||||||
except self.model.DoesNotExist:
|
except self.model.DoesNotExist:
|
||||||
functions_log.log_errmsg("Unable to set config value for %s (does not exist):\n%s" % (
|
logger.log_errmsg("Unable to set config value for %s (does not exist):\n%s" % (
|
||||||
configname, (format_exc())))
|
configname, (format_exc())))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from apps.objects.models import Object
|
||||||
import defines_global
|
import defines_global
|
||||||
import cmdtable
|
import cmdtable
|
||||||
import functions_general
|
import functions_general
|
||||||
import functions_log
|
from src import logger
|
||||||
from src import comsys
|
from src import comsys
|
||||||
|
|
||||||
class UnknownCommand(Exception):
|
class UnknownCommand(Exception):
|
||||||
|
|
@ -225,7 +225,7 @@ def handle(cdat):
|
||||||
cmd(cdat)
|
cmd(cdat)
|
||||||
except:
|
except:
|
||||||
session.msg("Untrapped error, please file a bug report:\n%s" % (format_exc(),))
|
session.msg("Untrapped error, please file a bug report:\n%s" % (format_exc(),))
|
||||||
functions_log.log_errmsg("Untrapped error, evoker %s: %s" %
|
logger.log_errmsg("Untrapped error, evoker %s: %s" %
|
||||||
(session, format_exc()))
|
(session, format_exc()))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import os
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
import functions_log
|
from src import logger
|
||||||
|
|
||||||
# A dictionary with keys equivalent to the script's name and values that
|
# A dictionary with keys equivalent to the script's name and values that
|
||||||
# contain references to the associated module for each key.
|
# contain references to the associated module for each key.
|
||||||
|
|
@ -48,16 +48,16 @@ def scriptlink(source_obj, scriptname):
|
||||||
try:
|
try:
|
||||||
# Change the working directory to the location of the script and import.
|
# Change the working directory to the location of the script and import.
|
||||||
os.chdir('%s/%s/' % (settings.SCRIPT_ROOT, newpath_str))
|
os.chdir('%s/%s/' % (settings.SCRIPT_ROOT, newpath_str))
|
||||||
functions_log.log_infomsg("SCRIPT: Caching and importing %s." % (modname))
|
logger.log_infomsg("SCRIPT: Caching and importing %s." % (modname))
|
||||||
modreference = __import__(modname)
|
modreference = __import__(modname)
|
||||||
# Store the module reference for later fast retrieval.
|
# Store the module reference for later fast retrieval.
|
||||||
cached_scripts[scriptname] = modreference
|
cached_scripts[scriptname] = modreference
|
||||||
except ImportError:
|
except ImportError:
|
||||||
functions_log.log_infomsg('Error importing %s: %s' % (modname, format_exc()))
|
logger.log_infomsg('Error importing %s: %s' % (modname, format_exc()))
|
||||||
os.chdir(settings.BASE_PATH)
|
os.chdir(settings.BASE_PATH)
|
||||||
return
|
return
|
||||||
except OSError:
|
except OSError:
|
||||||
functions_log.log_infomsg('Invalid module path: %s' % (format_exc()))
|
logger.log_infomsg('Invalid module path: %s' % (format_exc()))
|
||||||
os.chdir(settings.BASE_PATH)
|
os.chdir(settings.BASE_PATH)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from apps.objects.models import Object
|
||||||
from apps.config.models import ConnectScreen, ConfigValue
|
from apps.config.models import ConnectScreen, ConfigValue
|
||||||
import cmdhandler
|
import cmdhandler
|
||||||
import functions_general
|
import functions_general
|
||||||
import functions_log
|
import logger
|
||||||
import session_mgr
|
import session_mgr
|
||||||
import ansi
|
import ansi
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
||||||
What to do when we get a connection.
|
What to do when we get a connection.
|
||||||
"""
|
"""
|
||||||
self.prep_session()
|
self.prep_session()
|
||||||
functions_log.log_infomsg('Connection: %s' % (self,))
|
logger.log_infomsg('Connection: %s' % (self,))
|
||||||
session_mgr.add_session(self)
|
session_mgr.add_session(self)
|
||||||
self.game_connect_screen()
|
self.game_connect_screen()
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
||||||
"""
|
"""
|
||||||
Execute this when a client abruplty loses their connection.
|
Execute this when a client abruplty loses their connection.
|
||||||
"""
|
"""
|
||||||
functions_log.log_infomsg('Disconnect: %s' % (self,))
|
logger.log_infomsg('Disconnect: %s' % (self,))
|
||||||
self.handle_close()
|
self.handle_close()
|
||||||
|
|
||||||
def load_user_channels(self):
|
def load_user_channels(self):
|
||||||
|
|
@ -155,7 +155,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
||||||
self.msg("You are now logged in as %s." % (self.name,))
|
self.msg("You are now logged in as %s." % (self.name,))
|
||||||
pobject.get_location().emit_to_contents("%s has connected." % (pobject.get_name(show_dbref=False),), exclude=pobject)
|
pobject.get_location().emit_to_contents("%s has connected." % (pobject.get_name(show_dbref=False),), exclude=pobject)
|
||||||
self.execute_cmd("look")
|
self.execute_cmd("look")
|
||||||
functions_log.log_infomsg("Login: %s" % (self,))
|
logger.log_infomsg("Login: %s" % (self,))
|
||||||
|
|
||||||
# Update their account's last login time.
|
# Update their account's last login time.
|
||||||
user.last_login = datetime.now()
|
user.last_login = datetime.now()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import time
|
||||||
|
|
||||||
from apps.config.models import ConfigValue
|
from apps.config.models import ConfigValue
|
||||||
import functions_general
|
import functions_general
|
||||||
import functions_log
|
from src import logger
|
||||||
|
|
||||||
# Our list of connected sessions.
|
# Our list of connected sessions.
|
||||||
session_list = []
|
session_list = []
|
||||||
|
|
@ -15,7 +15,7 @@ def add_session(session):
|
||||||
Adds a session to the session list.
|
Adds a session to the session list.
|
||||||
"""
|
"""
|
||||||
session_list.insert(0, session)
|
session_list.insert(0, session)
|
||||||
functions_log.log_infomsg('Sessions active: %d' % (len(get_session_list(return_unlogged=True),)))
|
logger.log_infomsg('Sessions active: %d' % (len(get_session_list(return_unlogged=True),)))
|
||||||
|
|
||||||
def get_session_list(return_unlogged=False):
|
def get_session_list(return_unlogged=False):
|
||||||
"""
|
"""
|
||||||
|
|
@ -71,9 +71,9 @@ def remove_session(session):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
session_list.remove(session)
|
session_list.remove(session)
|
||||||
functions_log.log_infomsg('Sessions active: %d' % (len(get_session_list()),))
|
logger.log_infomsg('Sessions active: %d' % (len(get_session_list()),))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
#functions_log.log_errmsg("Unable to remove session: %s" % (session,))
|
#logger.log_errmsg("Unable to remove session: %s" % (session,))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue