Use ISO 8601 time in logs
[mudpy.git] / mudpy / misc.py
index 7c013a8..0e7e561 100644 (file)
@@ -5,6 +5,7 @@
 # provided in the LICENSE file distributed with this software.
 
 import codecs
+import datetime
 import os
 import random
 import re
@@ -986,7 +987,7 @@ def log(message, level=0):
         file_name = ""
         max_log_lines = 0
         syslog_name = ""
-    timestamp = time.asctime()[4:19]
+    timestamp = datetime.datetime.now().isoformat(' ')
 
     # turn the message into a list of nonempty lines
     lines = [x for x in [(x.rstrip()) for x in message.split("\n")] if x != ""]
@@ -1191,7 +1192,7 @@ def weighted_choice(data):
 
     # create the expanded list of keys
     for key in data.keys():
-        for count in range(data[key]):
+        for _count in range(data[key]):
             expanded.append(key)
 
     # return one at random
@@ -1242,7 +1243,7 @@ def random_name():
     name = ""
 
     # create a name of random length from the syllables
-    for syllable in range(random.randrange(2, 6)):
+    for _syllable in range(random.randrange(2, 6)):
         name += weighted_choice(syllables)
 
     # strip any leading quotemark, capitalize and return the name