-
Notifications
You must be signed in to change notification settings - Fork 9
Logging
Search compiler uses sc.logging.Logger
objects to manage printing to stdout and writing to log files.
import search_compiler as sc
mylogger = sc.logging.Logger(stdout_enabled, output_file, verbosity)
mylogger.logprint(text, verbosity)
-
stdout_enabled
- This is a boolean that defines whether logs should be printed to stdout. The default value isFalse
. -
output_file
- This is a string that provides a filepath that the logger will write to. The default value isNone
, which causes no file to be written. -
verbosity
- This is the verbosity of theLogger
, which controls how much content is logged. The default value is1
. A value of0
will silence all output, a value of1
will log the default amount of output, and a value of2
will log more detailed output. See the section on verbosity below for more information.
-
text
- This is the text that will be logged. -
verbosity
- This is the verbosity of the print call, which is compared to the verbosity of theLogger
to decide whether this call is ignored or not. The default value is1
. See the section on verbosity below for more details.
The amount of content logged is controlled by the verbosity
setting on the Logger
object. When a logprint
call is made, the logprint
verbosity represents the importance of the print, with lower values being more important. If the verbosity of the Logger
is lower than the verbosity of the logprint
, then the logprint
call is ignored.
search_compiler
uses two levels of logprint
calls, with verbosity at 1
and verbosity at 2
. If the Logger
verbosity is set to 1
, the logprint
calls with verbosity 1
will be logged, and those with verbosity 2
will be ignored. Setting the Logger
verbosity to 2
will cause all logprint
s to be logged, and setting the Logger
verbosity to 1
will cause all logprint
s to be ignored. Other verbosity levels are supported, but currently not used by search_compiler
.