mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 22:36:31 +01:00
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 django.db import models
|
||||
import functions_log
|
||||
from src import logger
|
||||
|
||||
class ConfigValueManager(models.Manager):
|
||||
def get_configvalue(self, configname):
|
||||
|
|
@ -13,7 +13,7 @@ class ConfigValueManager(models.Manager):
|
|||
try:
|
||||
return self.get(conf_key__iexact=configname).conf_value
|
||||
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())))
|
||||
|
||||
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.
|
||||
return newvalue
|
||||
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())))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from apps.objects.models import Object
|
|||
import defines_global
|
||||
import cmdtable
|
||||
import functions_general
|
||||
import functions_log
|
||||
from src import logger
|
||||
from src import comsys
|
||||
|
||||
class UnknownCommand(Exception):
|
||||
|
|
@ -225,7 +225,7 @@ def handle(cdat):
|
|||
cmd(cdat)
|
||||
except:
|
||||
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()))
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import os
|
|||
from traceback import format_exc
|
||||
|
||||
import settings
|
||||
import functions_log
|
||||
from src import logger
|
||||
|
||||
# A dictionary with keys equivalent to the script's name and values that
|
||||
# contain references to the associated module for each key.
|
||||
|
|
@ -48,16 +48,16 @@ def scriptlink(source_obj, scriptname):
|
|||
try:
|
||||
# Change the working directory to the location of the script and import.
|
||||
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)
|
||||
# Store the module reference for later fast retrieval.
|
||||
cached_scripts[scriptname] = modreference
|
||||
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)
|
||||
return
|
||||
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)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from apps.objects.models import Object
|
|||
from apps.config.models import ConnectScreen, ConfigValue
|
||||
import cmdhandler
|
||||
import functions_general
|
||||
import functions_log
|
||||
import logger
|
||||
import session_mgr
|
||||
import ansi
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
|||
What to do when we get a connection.
|
||||
"""
|
||||
self.prep_session()
|
||||
functions_log.log_infomsg('Connection: %s' % (self,))
|
||||
logger.log_infomsg('Connection: %s' % (self,))
|
||||
session_mgr.add_session(self)
|
||||
self.game_connect_screen()
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
|||
"""
|
||||
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()
|
||||
|
||||
def load_user_channels(self):
|
||||
|
|
@ -155,7 +155,7 @@ class SessionProtocol(StatefulTelnetProtocol):
|
|||
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)
|
||||
self.execute_cmd("look")
|
||||
functions_log.log_infomsg("Login: %s" % (self,))
|
||||
logger.log_infomsg("Login: %s" % (self,))
|
||||
|
||||
# Update their account's last login time.
|
||||
user.last_login = datetime.now()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import time
|
|||
|
||||
from apps.config.models import ConfigValue
|
||||
import functions_general
|
||||
import functions_log
|
||||
from src import logger
|
||||
|
||||
# Our list of connected sessions.
|
||||
session_list = []
|
||||
|
|
@ -15,7 +15,7 @@ def add_session(session):
|
|||
Adds a session to the session list.
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
|
|
@ -71,9 +71,9 @@ def remove_session(session):
|
|||
"""
|
||||
try:
|
||||
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:
|
||||
#functions_log.log_errmsg("Unable to remove session: %s" % (session,))
|
||||
#logger.log_errmsg("Unable to remove session: %s" % (session,))
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue