log #

enum Level #

enum Level {
	fatal = 1
	error
	warn
	info
	debug
}

Level defines possible log levels used by Log

enum LogTarget #

enum LogTarget {
	console
	file
	both
}

struct Log #

struct Log {
mut:
	level         Level
	output_label  string
	ofile         os.File
	output_target LogTarget
pub mut:
	output_file_name string
}

Log represents a logging object

fn (Log) get_level #

fn (mut l Log) get_level() Level

get_level gets the internal logging level.

fn (Log) set_level #

fn (mut l Log) set_level(level Level)

set_level sets the internal logging to level.

fn (Log) set_output_level #

fn (mut l Log) set_output_level(level Level)

set_output_level sets the internal logging output to level.

fn (Log) set_full_logpath #

fn (mut l Log) set_full_logpath(full_log_path string)

set_full_logpath sets the output label and output path from full_log_path.

fn (Log) set_output_label #

fn (mut l Log) set_output_label(label string)

set_output_label sets the label for the output.

fn (Log) set_output_path #

fn (mut l Log) set_output_path(output_file_path string)

set_output_path sets the file to which output is logged to.

fn (Log) log_to_console_too #

fn (mut l Log) log_to_console_too()

log_to_console_too turns on logging to the console too, in addition to logging to a file.
You have to call it after calling .set_output_path(output_file_path).

fn (Log) flush #

fn (mut l Log) flush()

flush writes the log file content to disk.

fn (Log) close #

fn (mut l Log) close()

close closes the log file.

fn (Log) send_output #

fn (mut l Log) send_output(s &string, level Level)

send_output writes log line s with level to either the log file or the console according to the value of the .output_target field.

fn (Log) fatal #

fn (mut l Log) fatal(s string)

fatal logs line s via send_output if Log.level is greater than or equal to the Level.fatal category.

fn (Log) error #

fn (mut l Log) error(s string)

error logs line s via send_output if Log.level is greater than or equal to the Level.error category.

fn (Log) warn #

fn (mut l Log) warn(s string)

warn logs line s via send_output if Log.level is greater than or equal to the Level.warn category.

fn (Log) info #

fn (mut l Log) info(s string)

info logs line s via send_output if Log.level is greater than or equal to the Level.info category.

fn (Log) debug #

fn (mut l Log) debug(s string)

debug logs line s via send_output if Log.level is greater than or equal to the Level.debug category.