Added an empty server.log file in order to be able to put the server/logs directory in git. Some more bugfixes.

This commit is contained in:
Griatch 2015-01-10 20:09:18 +01:00
parent 8e93df299f
commit 8d473b7663
5 changed files with 52 additions and 29 deletions

View file

@ -16,6 +16,7 @@ historical, back-compatible reasons.
"""
import os
from datetime import datetime
from traceback import format_exc
from twisted.python import log
@ -112,7 +113,7 @@ LOG_FILE_HANDLES = {} # holds open log handles
def log_file(msg, filename="game.log"):
"""
Arbitrary file logger using threads. Filename defaults to
'game.log'. All logs will appear in game/logs directory and log
'game.log'. All logs will appear in the logs directory and log
entries will start on new lines following datetime info.
"""
global LOG_FILE_HANDLES
@ -129,8 +130,8 @@ def log_file(msg, filename="game.log"):
"Catching errors to normal log"
log_trace()
# save to game/logs/ directory
filename = "logs/" + filename
# save to server/logs/ directory
filename = os.path.join("server", "logs", filename)
if filename in LOG_FILE_HANDLES:
filehandle = LOG_FILE_HANDLES[filename]

View file

@ -178,7 +178,8 @@ def time_format(seconds, style=0):
Style 0: 1d 08:30
Style 1: 1d
Style 2: 1 day, 8 hours, 30 minutes, 10 seconds
Style 2: 1 day, 8 hours, 30 minutes
Style 3: 1 day, 8 hours, 30 minutes, 10 seconds
"""
if seconds < 0:
seconds = 0
@ -263,7 +264,7 @@ def time_format(seconds, style=0):
seconds_str = '%i seconds ' % seconds
retval = '%s%s%s%s' % (days_str, hours_str, minutes_str, seconds_str)
return retval
return retval.strip()
def datetime_format(dtobj):