mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 02:06:32 +01:00
Use logger rather than print for these messages.
This commit is contained in:
parent
3357712103
commit
c8fbd2860d
4 changed files with 15 additions and 12 deletions
|
|
@ -8,7 +8,8 @@ from __future__ import print_function
|
|||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from evennia.typeclasses.managers import (TypedObjectManager, TypeclassManager,
|
||||
returns_typeclass_list, returns_typeclass)
|
||||
returns_typeclass_list, returns_typeclass)
|
||||
from evennia.utils import logger
|
||||
|
||||
_GA = object.__getattribute__
|
||||
_PlayerDB = None
|
||||
|
|
@ -109,7 +110,7 @@ def to_object(inp, objtype='player'):
|
|||
return _PlayerDB.objects.get(user_username__iexact=obj)
|
||||
if typ == 'dbref':
|
||||
return _PlayerDB.objects.get(id=obj)
|
||||
print(objtype, inp, obj, typ, type(inp))
|
||||
logger.log_err("%s %s %s %s %s", objtype, inp, obj, typ, type(inp))
|
||||
raise CommError()
|
||||
elif objtype == 'object':
|
||||
if typ == 'player':
|
||||
|
|
@ -118,14 +119,14 @@ def to_object(inp, objtype='player'):
|
|||
return _ObjectDB.objects.get(db_key__iexact=obj)
|
||||
if typ == 'dbref':
|
||||
return _ObjectDB.objects.get(id=obj)
|
||||
print(objtype, inp, obj, typ, type(inp))
|
||||
logger.log_err("%s %s %s %s %s", objtype, inp, obj, typ, type(inp))
|
||||
raise CommError()
|
||||
elif objtype == 'channel':
|
||||
if typ == 'string':
|
||||
return _ChannelDB.objects.get(db_key__iexact=obj)
|
||||
if typ == 'dbref':
|
||||
return _ChannelDB.objects.get(id=obj)
|
||||
print(objtype, inp, obj, typ, type(inp))
|
||||
logger.log_err("%s %s %s %s %s", objtype, inp, obj, typ, type(inp))
|
||||
raise CommError()
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ except ImportError:
|
|||
from twisted.protocols import amp
|
||||
from twisted.internet import protocol, reactor
|
||||
from twisted.internet.defer import Deferred
|
||||
from evennia.utils import logger
|
||||
from evennia.utils.utils import to_str, variable_from_module
|
||||
|
||||
# communication bits
|
||||
|
|
@ -377,8 +378,8 @@ class AMPProtocol(amp.AMP):
|
|||
|
||||
"""
|
||||
e.trap(Exception)
|
||||
print("AMP Error for %(info)s: %(e)s" % {'info': info,
|
||||
'e': e.getErrorMessage()})
|
||||
logger.log_err("AMP Error for %(info)s: %(e)s" % {'info': info,
|
||||
'e': e.getErrorMessage()})
|
||||
|
||||
def send_data(self, command, sessid, **kwargs):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from django.conf import settings
|
|||
from django.utils.translation import ugettext as _
|
||||
from evennia.players.models import PlayerDB
|
||||
from evennia.server.models import ServerConfig
|
||||
from evennia.utils import create
|
||||
from evennia.utils import create, logger
|
||||
|
||||
|
||||
ERROR_NO_SUPERUSER = \
|
||||
|
|
@ -70,7 +70,7 @@ def create_objects():
|
|||
|
||||
"""
|
||||
|
||||
print(" Creating objects (Player #1 and Limbo room) ...")
|
||||
logger.log_info("Creating objects (Player #1 and Limbo room) ...")
|
||||
|
||||
# Set the initial User's account object's username on the #1 object.
|
||||
# This object is pure django and only holds name, email and password.
|
||||
|
|
@ -132,7 +132,7 @@ def create_channels():
|
|||
Creates some sensible default channels.
|
||||
|
||||
"""
|
||||
print(" Creating default channels ...")
|
||||
logger.log_info("Creating default channels ...")
|
||||
|
||||
goduser = get_god_player()
|
||||
for channeldict in settings.DEFAULT_CHANNELS:
|
||||
|
|
@ -155,7 +155,7 @@ def at_initial_setup():
|
|||
mod = __import__(modname, fromlist=[None])
|
||||
except (ImportError, ValueError):
|
||||
return
|
||||
print(" Running at_initial_setup() hook.")
|
||||
logger.log_info(" Running at_initial_setup() hook.")
|
||||
if mod.__dict__.get("at_initial_setup", None):
|
||||
mod.at_initial_setup()
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ def reset_server():
|
|||
|
||||
"""
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
print(" Initial setup complete. Restarting Server once.")
|
||||
logger.log_info(" Initial setup complete. Restarting Server once.")
|
||||
SESSIONS.server.shutdown(mode='reset')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from twisted.internet import threads, defer, reactor
|
|||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext as _
|
||||
from evennia.utils import logger
|
||||
|
||||
_MULTIMATCH_SEPARATOR = settings.SEARCH_MULTIMATCH_SEPARATOR
|
||||
|
||||
|
|
@ -870,7 +871,7 @@ def check_evennia_dependencies():
|
|||
errstring = errstring.strip()
|
||||
if errstring:
|
||||
mlen = max(len(line) for line in errstring.split("\n"))
|
||||
print("%s\n%s\n%s" % ("-"*mlen, errstring, '-'*mlen))
|
||||
logger.log_err("%s\n%s\n%s" % ("-"*mlen, errstring, '-'*mlen))
|
||||
return not_error
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue