Skip to content
Snippets Groups Projects
Commit b531c6b5 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

LoggerInterface API added

parent 35dd8be8
No related branches found
No related tags found
No related merge requests found
from satella.instrumentation.logging.logentry import LogEntry from satella.instrumentation.logging.logentry import LogEntry
from satella.instrumentation.logging.logset import LogSet from satella.instrumentation.logging.logset import LogSet
\ No newline at end of file from satella.instrumentation.logging.loggerinterface import LoggerInterface
class LoggerInterface(object):
"""Interface for logger classes"""
def specialize_tag(self, tag):
"""
Return a new class with logger interface.
The child class will log all events to parent
logger, save for the fact that each entry will
have 'tag' added to list of tags.
@param tag: tag that will be added to each entry
@type tag: str
@return: L{LoggerInterface} implementation instance
"""
raise RuntimeError, 'abstract'
def specialize_hierarchy(self, h):
"""
Return a new class with logger interface.
The child class will log all events to parent
logger, save for the fact that each entry will
have 'h' prepended to hierarchy (along with the
needed dot - or not if logged hierarchy is empty)
@param tag: tag that will be added to each entry
@type tag: str
@return: L{LoggerInterface} implementation instance
"""
raise RuntimeError, 'abstract'
def log(self, *args, **kwargs):
"""
Invoke appropriate LogEntry constructor with
*args and **kwargs.
Relay the log onto suitable logging backend.
"""
raise RuntimeError, 'abstract'
\ No newline at end of file
from satella.instrumentation.logging import LogEntry, LogSet from satella.instrumentation.logging import LogEntry, LogSet, LoggerInterface
# LoggerInterface is implemented only as API check
import unittest import unittest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment