logger

package
v0.0.0-...-496bd57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package logger provides logging capability for an application or service. TODO: make this its own go module outside of cleanpg

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogToStderr

func LogToStderr(flag bool)

LogToStderr determines whether log messages will print to stderr as well as the log file

func SetLogFile

func SetLogFile(fileName string)

SetLogFile sets the name of the log file. If not set, the default filename is "log.txt"

func Truncate

func Truncate() error

Truncate is used to truncate the log file to zero length

func Write

func Write(messageType MessageType, format string, a ...interface{})

Write is a function which writes a variable length string message to the log file

Types

type MessageType

type MessageType int

MessageType holds the log level of the message. Possible values: INFO | NOTICE | WARNING | ERROR | FATAL

const (
	// INFO indicates generally useful information
	INFO MessageType = 0
	// NOTICE indicates program state changes that are not abnormal
	NOTICE MessageType = iota
	// WARNING indicates application oddities that are recoverable
	WARNING
	// ERROR indicates condition fatal to the operation
	// but not to the application
	ERROR
	// FATAL indicates condition is fatal to the application or service
	// and will force a shutdown
	FATAL
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL