Commits

Andrew Godwin committed 99b3cef

Emailing of errors.

Comments (0)

Files changed (3)

myne/plugins/debug.py

         pdb.set_trace()
     
     def commandTest(self, parts):
-        self.client.sendServerMessage("TESSSST!")
+        import logging
+        logging.log(logging.ERROR, "Test error!")
     
     def __del__(self):
         print "delDebug"
 
 import sys
 import logging
+from logging.handlers import SMTPHandler
 from twisted.internet import reactor
 
 from myne.server import MyneFactory
 reactor.listenTCP(factory.config.getint("network", "controller_port"), controller)
 logging.log(logging.INFO, "Running!")
 
+# Setup email handler
+if factory.config.has_section("email"):
+    emh = SMTPHandler(
+        factory.config.get("email", "host"),
+        factory.config.get("email", "from"),
+        [factory.config.get("email", "to")],
+        factory.config.get("email", "subject"),
+    )
+    emh.setLevel(logging.ERROR)
+    logging.root.addHandler(emh)
+
 try:
     reactor.run()
 finally:

server.conf.example

 home:
 messaging:
 hide:
-help:
+help:
+
+
+#[email]
+#host = localhost
+#from = errors@localhost
+#to = test@example.com
+#subject = Minecraft Server Error