logalpha.contrib.standard




class StandardMessage(level: logalpha.level.Level, content: str, timestamp: datetime.datetime, topic: str, host: str)[source]

Bases: logalpha.message.Message

A message with standard attributes.




class StandardLogger(topic: str)[source]

Bases: logalpha.logger.Logger

Logger with StandardMessage.


levels = [Level(name='DEBUG', value=0), Level(name='INFO', value=1), Level(name='WARNING', value=2), Level(name='ERROR', value=3), Level(name='CRITICAL', value=4)]
colors = [Color(name='blue', foreground='\x1b[34m', background='\x1b[44m'), Color(name='green', foreground='\x1b[32m', background='\x1b[42m'), Color(name='yellow', foreground='\x1b[33m', background='\x1b[43m'), Color(name='red', foreground='\x1b[31m', background='\x1b[41m'), Color(name='magenta', foreground='\x1b[35m', background='\x1b[45m')]



class StandardHandler(level: logalpha.level.Level = Level(name='WARNING', value=2), resource: IO = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>)[source]

Bases: logalpha.handler.StreamHandler

A standard message handler writes to <stderr> by default. Message format includes all attributes.

Attributes:
level (Level):

The level for this handler.

resource (Any):

Some resource to publish messages to.


format(message: logalpha.contrib.standard.StandardMessage) → str[source]

Format the message.




DEBUG = Level(name='DEBUG', value=0)
INFO = Level(name='INFO', value=1)
WARNING = Level(name='WARNING', value=2)
ERROR = Level(name='ERROR', value=3)
CRITICAL = Level(name='CRITICAL', value=4)