Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Updated syntax across all files
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Downs committed Jan 4, 2012
1 parent 61d46b5 commit c198aa2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -16,9 +16,9 @@ logger = lggr.Lggr() # create a logging object
logger.disable() # silently stop logging - for when you don't need it, but might in the future
logger.enable() # turn the logging back on

logger.addMethod(lggr.INFO, lggr.Printer()) # log all info() calls to STDOUT
logger.addMethod(lggr.CRITICAL, lggr.FilePrinter("output.log")) # log all critical() calls to an output file
logger.addMethod(None, lggr.ErrorPrinter()) # log all logging calls to STDERR
logger.add(lggr.INFO, lggr.Printer()) # log all info() calls to STDOUT
logger.add(lggr.CRITICAL, lggr.FilePrinter("output.log")) # log all critical() calls to an output file
logger.add(None, lggr.ErrorPrinter()) # log all logging calls to STDERR

logger.info("Here is a low level warning. It will be written to STDOUT and STDERR")
logger.warning("This is a warning. It is written to STDERR.")
Expand All @@ -30,7 +30,7 @@ logger.info("{noun} is so {adjective}, I'd {verb} its {pl_noun}",

logger.warning("WARNING: {} is a {}. You should know this", lggr.Lggr, type(lggr.Lggr))

logger.clearMethods(lggr.CRITICAL) # remove all methods from a specific level
logger.clear(lggr.CRITICAL) # remove all methods from a specific level

logger.close() # stop logging
```
Expand Down
4 changes: 2 additions & 2 deletions lggr/__init__.py
Expand Up @@ -32,7 +32,7 @@ def enable(self):
self.turned_on = True

def close(self):
self.clearMethods()
self.clear()


def add(self, level, logger):
Expand Down Expand Up @@ -101,7 +101,7 @@ def log(self, level, fmt, *args, **kwargs):
try:
logger.send(message)
except StopIteration: # already closed
self.removeMethod(levset, logger)
self.remove(levset, logger)
self.info("Logging function {} in level {} stopped.", logger, levset)

def critical(self, msg, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion test.py
Expand Up @@ -10,7 +10,7 @@
except Exception as e:
print e

for i, level in enumerate(d.getMethods()):
for i, level in enumerate(d.get()):
print "Level {}:".format(i)
for item in level:
print '\t{}'.format(item)
Expand Down

0 comments on commit c198aa2

Please sign in to comment.