pycassa.logging.pycassa_logger – Pycassa Logging

Logging facilities for pycassa.

class pycassa.logging.pycassa_logger.PycassaLogger

The root logger for pycassa.

This uses a singleton-like pattern, so creating a new instance will always give you the same result. This means that you can adjust all of pycassa’s logging by calling methods on any instance.

pycassa does not automatically add a handler to the logger, so logs will not be captured by default. You must add a logging.Handler() object to the root handler for logs to be captured. See the example usage below.

By default, the root logger name is ‘pycassa’ and the logging level is ‘info’.

The available levels are:

  • debug
  • info
  • warn
  • error
  • critical

Example Usage:

>>> import logging
>>> log = pycassa.PycassaLogger()
>>> log.set_logger_name('pycassa_library')
>>> log.set_logger_level('debug')
>>> log.get_logger().addHandler(logging.StreamHandler())
add_child_logger(child_logger_name, name_change_callback)

Adds a child logger to pycassa that will be updated when the logger name changes.

get_logger()

Returns the underlying logging.Logger instance.

get_logger_level()

Gets the logging level for all pycassa logging.

get_logger_name()

Gets the root logger name for pycassa.

set_logger_level(level)

Sets the logging level for all pycassa logging.

set_logger_name(logger_name)

Sets the root logger name for pycassa and all of its children loggers.

Previous topic

pycassa.util – Utilities

Next topic

pycassa.logging.pool_stats_logger – Connection Pool Stats

This Page