Logging

This package use the standard python logging module to provide some insightfull logging information. This page gives a basic introduction on how to use it. For more information on loggers, you can take a look at the official documentation.

In order to have nicer formatting of logging messages, you need a StreamHandler. You can create your own, use an existing one or call create_stream_handler(). Additionally, the lightnet package provides the create_file_handler() function to write lightnet log information to a file.

When using the lightnet StreamHandler, there are 2 ways to set the logging level.
The first is by using the LN_LOGLVL environment variable. Setting this environment variable before running a lightnet script will force lightnet to filter out messages up to that specified level.
The second method is to call the setLevel() method on the returned StreamHandler from create_stream_handler().

API

lightnet.create_stream_handler()[source]

Create a handler to write lightnet log messages to the console.

The default LogLevel is INFO, but this can be changed with the LN_LOGLVL environment variable, or by calling the setLevel() method on the returned StreamHandler.

lightnet.create_file_handler(self, filename, levels=None, filemode='a')[source]

Create a file to write lightnet log messages of certaing levels