thirdai.logging
The thirdai internal logging library uses spdlog to do logging within the C++ library. This requires a setup at the start of your program. Further capability to write to these configured logs are exposed in Python via functions so that C++ library and Python may have sychronized single place to store logs of the program.
Setup
The following function can be used to setup logging at the start of the program.
- thirdai.logging.setup(log_to_stderr: bool = True, path: str = '', level: str = 'info', pattern: str = '[%Y-%m-%dT%T] [%l] | %v', flush_interval: int = 10) None
Set up log for thirdai C++ library.
- Parameters:
log_to_stderr (bool) – Print logs to standard error. Turned off (false) by default.
path (str) – Path to file to write logs to. Empty (default) implies no file log.
level (str) – Print logs upto this level. Choices are trace,debug,info,warn,critical,error,off. Default is info.
pattern (str) – Pattern string to customize log from client. See https://github.com/gabime/spdlog/wiki/3.-Custom-formatting for using format-strings.
flush_interval (int) – Interval in seconds at which logs will be flushed while in operation.
Logging
The following are python bindings to the log::<level> functions available in the thirdai C++ library.
- thirdai.logging.trace(arg0: str) None
Write to logs with level trace.
- thirdai.logging.debug(arg0: str) None
Write to logs with level debug.
- thirdai.logging.info(arg0: str) None
Write to logs with level info.
- thirdai.logging.warn(arg0: str) None
Write to logs with level warn.
- thirdai.logging.error(arg0: str) None
Write to logs with level error.
- thirdai.logging.critical(arg0: str) None
Write to logs with level critical.