gpclogging

package
v0.0.0-...-ee14c80 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default filename prefix for logfiles
	//DefFilenamePrefix = "%P.%H.%U"
	DefFilenamePrefix = "%P"
)

const strings

Variables

This section is empty.

Functions

func Debug

func Debug(format string, args ...interface{})

Debug logs down a log with Debug level. If parameter logDebug of logger.Init() is set to be false, no Debug logs will be logged down.

func Error

func Error(format string, args ...interface{})

Error logs down a log with error level.

func GetLogFileForProcess

func GetLogFileForProcess(execName string) (*os.File, error)

GetLogFileForProcess provides a opened file for logging process output

func Info

func Info(format string, args ...interface{})

Info logs down a log with info level.

func Init

func Init(logpath string, maxfiles, nfilesToDel int, maxsize uint32, logDebug bool) error

Init must be called first, otherwise this logger will not function properly! It returns nil if all goes well, otherwise it returns the corresponding error.

maxfiles: Must be greater than 0 and less than or equal to 100000.
nfilesToDel: Number of files deleted when number of log files reaches `maxfiles`.
             Must be greater than 0 and less than or equal to `maxfiles`.
maxsize: Maximum size of a log file in MB, 0 means unlimited.
logDebug: If set to false, `logger.Debug("xxxx")` will be mute.

func SetFilenamePrefix

func SetFilenamePrefix(logfilenamePrefix string) error

SetFilenamePrefix sets filename prefix for the logfiles.

Filename format for logfiles is `PREFIX`.`SEVERITY_LEVEL`.`DATE_TIME`.log 3 kinds of placeholders can be used in the prefix: %P, %H and %U. %P means program name, %H means hostname, %U means username. The default prefix for a log filename is logger.DefFilenamePrefix ("%P.%H.%U").

func SetLogFilenameLineNum

func SetLogFilenameLineNum(on bool)

SetLogFilenameLineNum sets whether to log down the filename and line number where the log takes place. By default, filename and line number are logged down. You can turn it off for better performance.

func SetLogFunctionName

func SetLogFunctionName(on bool)

SetLogFunctionName sets whether to log down the function name where the log takes place. By default, function name is not logged down for better performance.

func SetLogToConsole

func SetLogToConsole(on bool)

SetLogToConsole sets whether to output logs to the console. By default, logs are not output to the console.

func Warn

func Warn(format string, args ...interface{})

Warn logs down a log with warning level.

Types

This section is empty.

Jump to

Keyboard shortcuts

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