Rename internal:logging: to .mudpy.log
authorJeremy Stanley <fungi@yuggoth.org>
Sun, 24 Jul 2016 01:14:10 +0000 (01:14 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Sun, 24 Jul 2016 01:14:10 +0000 (01:14 +0000)
Convert the old style internal:logging element to a new style
.mudpy.log element and adjust the log() function accordingly.

etc/mudpy.yaml
lib/mudpy/misc.py

index 0d61479..74cfe6e 100644 (file)
@@ -18,11 +18,10 @@ __control__:
 #.mudpy.limit.backups: 10
 .mudpy.limit.password_tries: 3
 
-internal:logging:
-    #file: mudpy.log
-    max_log_lines: 1000
-    stdout: yes
-    #syslog: mudpy
+#.mudpy.log.file: mudpy.log
+.mudpy.log.lines: 1000
+.mudpy.log.stdout: true
+#.mudpy.log.syslog: mudpy
 
 internal:network:
     host: ::1
index 2dc75c0..c5e1d1b 100644 (file)
@@ -1008,11 +1008,9 @@ def log(message, level=0):
     """Log a message."""
 
     # a couple references we need
-    file_name = universe.categories["internal"]["logging"].get("file")
-    max_log_lines = universe.categories["internal"]["logging"].get(
-        "max_log_lines"
-    )
-    syslog_name = universe.categories["internal"]["logging"].get("syslog")
+    file_name = universe.contents["mudpy.log"].get("file")
+    max_log_lines = universe.contents["mudpy.log"].get("lines")
+    syslog_name = universe.contents["mudpy.log"].get("syslog")
     timestamp = time.asctime()[4:19]
 
     # turn the message into a list of nonempty lines
@@ -1029,7 +1027,7 @@ def log(message, level=0):
         file_descriptor.close()
 
     # send the timestamp and line to standard output
-    if universe.categories["internal"]["logging"].get("stdout"):
+    if universe.contents["mudpy.log"].get("stdout"):
         for line in lines:
             print(timestamp + " " + line)