mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 06:16:31 +01:00
Fix-length log file date format, retain unix sort. Resolves #1721.
This commit is contained in:
parent
690a11754d
commit
0a062517bd
2 changed files with 13 additions and 1 deletions
|
|
@ -99,6 +99,8 @@ Web/Django standard initiative (@strikaco)
|
|||
- OOB: Add support for MSDP LIST, REPORT, UNREPORT commands (re-mapped to `msdp_list`,
|
||||
`msdp_report`, `msdp_unreport` inlinefuncs_)
|
||||
- Added `evennia.ANSIString` to flat API.
|
||||
- Server/Portal log files now cycle to names on the form `server_.log_19_03_08_` instead of `server.log___19.3.8`, retaining
|
||||
unix file sorting order.
|
||||
|
||||
### Utils
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def timeformat(when=None):
|
|||
|
||||
class WeeklyLogFile(logfile.DailyLogFile):
|
||||
"""
|
||||
Log file that rotates once per week
|
||||
Log file that rotates once per week. Overrides key methods to change format
|
||||
|
||||
"""
|
||||
day_rotation = 7
|
||||
|
|
@ -84,6 +84,16 @@ class WeeklyLogFile(logfile.DailyLogFile):
|
|||
then = self.lastDate
|
||||
return now[0] > then[0] or now[1] > then[1] or now[2] > (then[2] + self.day_rotation)
|
||||
|
||||
def suffix(self, tupledate):
|
||||
"""Return the suffix given a (year, month, day) tuple or unixtime.
|
||||
Format changed to have 03 for march instead of 3 etc (retaining unix file order)
|
||||
"""
|
||||
try:
|
||||
return '_'.join(["{:02d}".format(part) for part in tupledate])
|
||||
except Exception:
|
||||
# try taking a float unixtime
|
||||
return '_'.join(["{:02d}".format(part) for part in self.toDate(tupledate)])
|
||||
|
||||
def write(self, data):
|
||||
"Write data to log file"
|
||||
logfile.BaseLogFile.write(self, data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue