brewtils.log package

Module contents

Brewtils Logging Utilities

This module streamlines loading logging configuration from Beergarden.

Example

To use this just call configure_logging sometime before you initialize your Plugin object:

from brewtils import configure_logging, get_connection_info, Plugin

# Load BG connection info from environment and command line args
connection_info = get_connection_info(sys.argv[1:])

configure_logging(system_name='systemX', **connection_info)

plugin = Plugin(
    my_client,
    name='systemX,
    version='0.0.1',
    **connection_info
)
plugin.run()
brewtils.log.configure_logging(system_name=None, **kwargs)[source]

Load and enable a logging configuration from Beergarden

NOTE: This method will overwrite the current logging configuration.

Parameters:
  • system_name – Name of the system to load
  • **kwargs – Beergarden connection parameters
Returns:

None

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_logging_config(system_name=None, **kwargs)[source]

Retrieve a logging configuration from Beergarden

Parameters:
  • system_name – Name of the system to load
  • **kwargs – Beergarden connection parameters
Returns:

The logging configuration for the specified system

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]

DEPRECATED: Get Beergarden’s logging configuration

This method is deprecated - consider using get_logging_config()

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]

DEPRECATED: Set Python logging to use configuration from Beergarden API

This method is deprecated - consider using configure_logging()

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