API

Contents:

pylog.pylog.init_logger(base_level=20, verbose_level=10, logging_config=None)[source]

initializes a base logger

you can use this to init a logger in any of your files. this will use config.py’s LOGGER param and logging.dictConfig to configure the logger for you.

Parameters:
  • base_level (int|logging.LEVEL) – desired base logging level
  • verbose_level (int|logging.LEVEL) – desired verbose logging level
  • logging_dict (dict) – dictConfig based configuration. used to override the default configuration from config.py
Return type:

python logger

pylog.pylog.set_global_verbosity_level(is_verbose_output=False)[source]

sets the global verbosity level for console and the lgr logger.

Parameters:is_verbose_output (bool) – should be output be verbose
pylog.pylog.get_current_time()[source]

returns the current time

pylog.pylog.calculate_throughput(elapsed_time, messages)[source]

calculates throughput and extracts the number of seconds for the run from the elapsed time

Parameters:
  • elapsed_time – run time
  • messages (int) – number of messages to write
Returns:

throughput and seconds

Return type:

tuple

pylog.pylog.send(instance, client, format, format_config, messages, gap, batch)[source]

sends logs and prints the time it took to send all logs

Parameters:
  • instance – transport class instance
  • client – client to use to send logs
  • format (string) – formatter to use
  • format_config (dict) – formatter configuration to use
  • messages (int) – number of messages to send
  • gap (float) – gap in seconds between 2 messages
  • batch (int) – number of messages per batch
pylog.pylog.config_transport(transports, transport, transport_config)[source]

returns a configured instance and client for the transport

Parameters:
  • transport (string) – transport to use
  • transport_config (dict) – transport configuration
pylog.pylog.generator(config=None, transport=None, formatter=None, gap=None, messages=None, batch=False, verbose=False)[source]

generates log messages

this will generate log message in the requested format and protocol.

Parameters:
  • config (string) – path to config file path
  • transport (string) – transport type to use
  • formatter (string) – formatter to use
  • gap (float) – gap in seconds between 2 messages
  • messages (int) – number of messages to send
pylog.pylog.list_fake_types()[source]

prints a list of random data types with an example

exception pylog.pylog.PylogError[source]

Bases: exceptions.Exception