Permalink
Browse files

Returns to .close() instead of .shutdown(); uses new process decorator

  • Loading branch information...
peterldowns committed Dec 3, 2012
1 parent a2ea6a8 commit 002677de5378c51eba17a5e66c60803f1bf2ea4d
Showing with 7 additions and 7 deletions.
  1. +1 −1 bin/test.py
  2. +6 −6 lggr/__init__.py
View
@@ -45,5 +45,5 @@ def final(c):
mylggr.info("Testing....")
mylggr.error("Testing {} {} {}", "another", "stupid", "thing")
-mylggr.shutdown()
+mylggr.close()
mylggr.log(lggr.ALL, "Help?")
View
@@ -8,7 +8,7 @@
import time
import inspect
import traceback
-from lggr.coroutine import Coroutine, CoroutineProcess, CoroutineThread
+from lggr.coroutine import coroutine, coroutine_process
__version__ = '0.1.5'
@@ -70,7 +70,7 @@ def enable(self):
""" Turn on logging. Enabled by default. """
self.enabled = True
- def shutdown(self):
+ def close(self):
""" Stop and remove all logging functions
and disable this logger. """
for level in ALL:
@@ -293,7 +293,7 @@ def _find_caller(self):
break
return rv
-@CoroutineProcess
+@coroutine_process
def Printer(open_file=sys.stdout, closing=False):
""" Prints items with a timestamp. """
try:
@@ -317,7 +317,7 @@ def FilePrinter(filename, mode='a', closing=True):
return Printer(f, closing)
import socket
-@CoroutineProcess
+@coroutine_process
def SocketWriter(host, port, af=socket.AF_INET, st=socket.SOCK_STREAM):
""" Writes messages to a socket/host. """
message = '({0}): {1}'
@@ -331,7 +331,7 @@ def SocketWriter(host, port, af=socket.AF_INET, st=socket.SOCK_STREAM):
s.close()
import smtplib
-@CoroutineProcess
+@coroutine_process
def Emailer(recipients, sender=None):
""" Sends messages as emails to the given list
of recipients. """
@@ -349,7 +349,7 @@ def Emailer(recipients, sender=None):
except GeneratorExit:
smtp.quit()
-@CoroutineProcess
+@coroutine_process
def GMailer(recipients, username, password, subject='Log message from lggr.py'):
""" Sends messages as emails to the given list
of recipients, from a GMail account. """

0 comments on commit 002677d

Please sign in to comment.