brewtils.log package

Module contents

Brewtils Logging Utilities

This module is for setting up your plugins logging correctly.

Example

In order to use this, you should simply call setup_logger in the same file where you initialize your plugin sometime before you initialize your Plugin object.

host = 'localhost'
port = 2337
ssl_enabled = False
system_name = 'my_system'

setup_logger(bg_host=host, bg_port=port, system_name=system_name, ssl_enabled=ssl_enabled)
plugin = Plugin(my_client, bg_host=host, bg_port=port, ssl_enabled=ssl_enabled,
                name=system_name, version="0.0.1")
plugin.run()
brewtils.log.convert_logging_config(logging_config)[source]

Converts a LoggingConfig object into a python logging configuration

The python logging configuration that is returned can be passed to logging.config.dictConfig

Parameters:logging_config
Returns:Python logging configuration
brewtils.log.get_python_logging_config(bg_host, bg_port, system_name, ca_cert=None, client_cert=None, ssl_enabled=None)[source]

Returns a dictionary for the python logging configuration

Parameters:
  • bg_host (str) – Hostname of a beer-garden
  • bg_port (int) – Port beer-garden is listening on
  • system_name (str) – The system
  • ca_cert – Certificate that issued the server certificate used by the beer-garden server
  • client_cert – Certificate used by the server making the connection to beer-garden
  • ssl_enabled (bool) – Whether to use SSL for beer-garden communication
Returns:

Python logging configuration

brewtils.log.setup_logger(bg_host, bg_port, system_name, ca_cert=None, client_cert=None, ssl_enabled=None)[source]

Configures python logging module to use logging specified in beer-garden API.

This method will overwrite your current logging configuration, so only call it if you want beer-garden’s logging configuration.

Parameters:
  • bg_host (str) – Hostname of a beer-garden
  • bg_port (int) – Port beer-garden is listening on
  • system_name (str) – The system
  • ca_cert – Certificate that issued the server certificate used by the beer-garden server
  • client_cert – Certificate used by the server making the connection to beer-garden
  • ssl_enabled (bool) – Whether to use SSL for beer-garden communication
Returns: