Logging¶
Usage
use Logging;
or
import Logging;
- enum LogLevel { DEBUG, INFO, WARN, ERROR, CRITICAL }¶
The LogLevel enum is used to provide a strongly-typed means of
configuring the logging level of a Logger object
- enum constant DEBUG¶
- enum constant INFO¶
- enum constant WARN¶
- enum constant ERROR¶
- enum constant CRITICAL¶
- enum LogChannel { CONSOLE, FILE }¶
The LogChannel enum is used to provide a strongly-typed means of
configuring the channel such as stdout or file where log messages
are written.
- enum constant CONSOLE¶
- enum constant FILE¶
- class OutputHandler¶
The OutputHandler class defines the interface for all derived
classes that write log messages to various channels.
- proc write(message: string) throws¶
- class ConsoleOutputHandler : OutputHandler¶
The ConsoleOutputHandler writes log messages to the Arkouda console.
- override proc write(message: string) throws¶
- class FileOutputHandler : OutputHandler¶
The FileOutputHandler writes log messages to the configured filePath.
- var filePath : string¶
- proc init(filePath: string)¶
- override proc write(message: string) throws¶
- proc writeToFile(filePath: string, line: string) throws¶
Writes to file, creating file if it does not exist
- proc getOutputHandler(channel: LogChannel) : owned OutputHandler throws¶
getOutputHandler is a factory method for OutputHandler implementations.
- class Logger¶
The Logger class provides structured log messages at various levels
of logging sensitivity analogous to other languages such as Python.
- var level : LogLevel = LogLevel.INFO¶
- var warnLevels = new set(LogLevel, [LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG])¶
- var criticalLevels = new set(LogLevel, [LogLevel.CRITICAL, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG])¶
- var errorLevels = new set(LogLevel, [LogLevel.ERROR, LogLevel.CRITICAL, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG])¶
- var infoLevels = new set(LogLevel, [LogLevel.INFO, LogLevel.DEBUG])¶
- var printDate : bool = true¶
- var outputHandler : owned OutputHandler = try! getOutputHandler(LogChannel.CONSOLE)¶
- proc init()¶
- proc init(level: LogLevel)
- proc init(level: LogLevel, channel: LogChannel)
- proc debug(moduleName, routineName, lineNumber, msg: string) throws¶
- proc info(moduleName, routineName, lineNumber, msg: string) throws¶
- proc warn(moduleName, routineName, lineNumber, msg: string) throws¶
- proc critical(moduleName, routineName, lineNumber, msg: string) throws¶
- proc error(moduleName, routineName, lineNumber, msg: string) throws¶
- proc generateErrorMsg(moduleName: string, routineName, lineNumber, error) throws¶
- proc generateLogMessage(moduleName: string, routineName, lineNumber, msg, level: string) throws¶
- proc generateDateTimeString() throws¶