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]

Transform a LoggingConfig object into a Python logging configuration

Parameters:logging_config – Beergarden logging config
Returns:The logging configuration
Return type:dict
brewtils.log.get_python_logging_config(bg_host, bg_port, system_name, ca_cert=None, client_cert=None, ssl_enabled=None)[source]

Get Beergarden’s logging configuration

Parameters:
  • bg_host (str) – Beergarden host
  • bg_port (int) – Beergarden port
  • system_name (str) – Name of the system
  • ca_cert (str) – Path to CA certificate file
  • client_cert (str) – Path to client certificate file
  • ssl_enabled (bool) – Use SSL when connection to Beergarden
Returns:

The logging configuration for the specified system

Return type:

dict

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

Sets Python logging to use configuration from Beergarden API

This method will overwrite the current logging configuration.

Parameters:
  • bg_host (str) – Beergarden host
  • bg_port (int) – Beergarden port
  • system_name (str) – Name of the system
  • ca_cert (str) – Path to CA certificate file
  • client_cert (str) – Path to client certificate file
  • ssl_enabled (bool) – Use SSL when connection to Beergarden

Returns: None