The Notifiers Module¶
The notifiers module implements special handlers for various platforms that depend on external libraries. The more module implements special handlers and other things that are beyond the scope of Logbook itself or depend on external libraries.
- logbook.notifiers.create_notification_handler(application_name=None, level=0, icon=None)¶
Creates a handler perfectly fit the current platform. On Linux systems this creates a
LibNotifyHandler
, on OS X systems it will create aGrowlHandler
.
OSX Specific Handlers¶
- class logbook.notifiers.GrowlHandler(application_name=None, icon=None, host=None, password=None, record_limit=None, record_delta=None, level=0, filter=None, bubble=False)¶
A handler that dispatches to Growl. Requires that either growl-py or py-Growl are installed.
- emit(record)¶
Emit the specified logging record. This should take the record and deliver it to whereever the handler sends formatted log records.
- get_priority(record)¶
Returns the priority flag for Growl. Errors and criticals are get highest priority (2), warnings get higher priority (1) and the rest gets 0. Growl allows values between -2 and 2.
- is_sticky(record)¶
Returns True if the sticky flag should be set for this record. The default implementation marks errors and criticals sticky.
Linux Specific Handlers¶
- class logbook.notifiers.LibNotifyHandler(application_name=None, icon=None, no_init=False, record_limit=None, record_delta=None, level=0, filter=None, bubble=False)¶
A handler that dispatches to libnotify. Requires pynotify installed. If no_init is set to True the initialization of libnotify is skipped.
- emit(record)¶
Emit the specified logging record. This should take the record and deliver it to whereever the handler sends formatted log records.
- get_expires(record)¶
Returns either EXPIRES_DEFAULT or EXPIRES_NEVER for this record. The default implementation marks errors and criticals as EXPIRES_NEVER.
- get_urgency(record)¶
Returns the urgency flag for pynotify. Errors and criticals are get highest urgency (CRITICAL), warnings get higher priority (NORMAL) and the rest gets LOW.
- set_notifier_icon(notifier, icon)¶
Used to attach an icon on a notifier object.
Other Services¶
- class logbook.notifiers.BoxcarHandler(email, password, record_limit=None, record_delta=None, level=0, filter=None, bubble=False)¶
Sends notifications to boxcar.io. Can be forwarded to your iPhone or other compatible device.
- emit(record)¶
Emit the specified logging record. This should take the record and deliver it to whereever the handler sends formatted log records.
- get_screen_name(record)¶
Returns the value of the screen name field.
- class logbook.notifiers.NotifoHandler(application_name=None, username=None, secret=None, record_limit=None, record_delta=None, level=0, filter=None, bubble=False, hide_level=False)¶
Sends notifications to notifo.com. Can be forwarded to your Desktop, iPhone, or other compatible device.
- emit(record)¶
Emit the specified logging record. This should take the record and deliver it to whereever the handler sends formatted log records.
- class logbook.notifiers.PushoverHandler(application_name=None, apikey=None, userkey=None, device=None, priority=0, sound=None, record_limit=None, record_delta=None, level=0, filter=None, bubble=False, max_title_len=100, max_message_len=512)¶
Sends notifications to pushover.net. Can be forwarded to your Desktop, iPhone, or other compatible device. If priority is not one of -2, -1, 0, or 1, it is set to 0 automatically.
- emit(record)¶
Emit the specified logging record. This should take the record and deliver it to whereever the handler sends formatted log records.
Base Interface¶
- class logbook.notifiers.NotificationBaseHandler(application_name=None, record_limit=None, record_delta=None, level=0, filter=None, bubble=False)¶
Baseclass for notification handlers.
- make_text(record)¶
Called to get the text of the record.
- make_title(record)¶
Called to get the title from the record.