Documentation
¶
Overview ¶
Package vplog contains a simple log helper which logs on both stderr and syslog.
Index ¶
- Constants
- func LogCrit(v ...interface{})
- func LogCritf(f string, v ...interface{})
- func LogDebug(v ...interface{})
- func LogDebugf(f string, v ...interface{})
- func LogErr(v ...interface{})
- func LogErrf(f string, v ...interface{})
- func LogFlush()
- func LogInfo(v ...interface{})
- func LogInfof(f string, v ...interface{})
- func LogInit(program string)
- func LogNotice(v ...interface{})
- func LogNoticef(f string, v ...interface{})
- func LogSetPriority(p Priority)
- func LogWarning(v ...interface{})
- func LogWarningf(f string, v ...interface{})
- func LoggerCrit(l Logger, v ...interface{})
- func LoggerCritf(l Logger, f string, v ...interface{})
- func LoggerDebug(l Logger, v ...interface{})
- func LoggerDebugf(l Logger, f string, v ...interface{})
- func LoggerErr(l Logger, v ...interface{})
- func LoggerErrf(l Logger, f string, v ...interface{})
- func LoggerInfo(l Logger, v ...interface{})
- func LoggerInfof(l Logger, f string, v ...interface{})
- func LoggerNotice(l Logger, v ...interface{})
- func LoggerNoticef(l Logger, f string, v ...interface{})
- func LoggerWarning(l Logger, v ...interface{})
- func LoggerWarningf(l Logger, f string, v ...interface{})
- func PriorityString(p Priority) string
- type Log
- type Logger
- type Priority
Constants ¶
const PackageCopyright = "Copyright (C) 2015, 2016 Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh
PackageCopyright contains a short copyright notice.
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh
PackageEmail contains a contact email for the package.
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh
PackageLicense contains a short license information.
const PackageName = "Vapor Toolkit" // PackageName set by version.sh
PackageName contains a readable name of the package, suitable for display.
const PackageTarname = "vapor" // PackageTarname set by version.sh
PackageTarname contains a short name of the package, suitable for a filename.
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh
PackageURL contains the address of the project homepage.
const VersionMajor = 0 // VersionMajor set by version.sh
VersionMajor is the project major version.
const VersionMinor = 4 // VersionMinor set by version.sh
VersionMinor is the project minor version.
const VersionStamp = "c6a4298" // VersionStamp set by version.sh
VersionStamp is the project stamp, possibly changes for each build.
Variables ¶
This section is empty.
Functions ¶
func LogCrit ¶
func LogCrit(v ...interface{})
LogCrit logs a critical message, no formatting. Uses the default global logging backend.
func LogCritf ¶
func LogCritf(f string, v ...interface{})
LogCritf logs a critical message, formatting "à la" printf. Uses the default global logging backend.
func LogDebug ¶
func LogDebug(v ...interface{})
LogDebug logs a debug message, no formatting. Uses the default global logging backend.
func LogDebugf ¶
func LogDebugf(f string, v ...interface{})
LogDebugf logs a debug message, formatting "à la" printf. Uses the default global logging backend.
func LogErr ¶
func LogErr(v ...interface{})
LogErr logs an error message, no formatting. Uses the default global logging backend.
func LogErrf ¶
func LogErrf(f string, v ...interface{})
LogErrf logs an error message, formatting "à la" printf. Uses the default global logging backend.
func LogFlush ¶
func LogFlush()
LogFlush flushes the global logging system, more precisely, flushes stderr.
func LogInfo ¶
func LogInfo(v ...interface{})
LogInfo logs an information message, no formatting. Uses the default global logging backend.
func LogInfof ¶
func LogInfof(f string, v ...interface{})
LogInfof logs an information message, formatting "à la" printf. Uses the default global logging backend.
func LogInit ¶
func LogInit(program string)
LogInit initializes the log system. This is not mandatory, you might use functions such as LogWarning right away, the log file will be opened on-the-fly if needed. However, you might prefer to have the file opened at the very beginning of the program, without waiting for an artificial event. This is why this function is here. It can also be used to force a given file to be used, by default the program name "vapor" is used but it can be overridden.
func LogNotice ¶
func LogNotice(v ...interface{})
LogNotice logs a notice message, no formatting. Uses the default global logging backend.
func LogNoticef ¶
func LogNoticef(f string, v ...interface{})
LogNoticef logs a notice message, formatting "à la" printf. Uses the default global logging backend.
func LogSetPriority ¶
func LogSetPriority(p Priority)
LogSetPriority sets the global, default logging level. Uses the default global logging backend.
func LogWarning ¶
func LogWarning(v ...interface{})
LogWarning logs a warning message, no formatting. Uses the default global logging backend.
func LogWarningf ¶
func LogWarningf(f string, v ...interface{})
LogWarningf logs a warning message, formatting "à la" printf. Uses the default global logging backend.
func LoggerCrit ¶
func LoggerCrit(l Logger, v ...interface{})
LoggerCrit logs a message with critical level. No formatting.
func LoggerCritf ¶
LoggerCritf logs a message with critical level. Formatting "à la" printf.
func LoggerDebug ¶
func LoggerDebug(l Logger, v ...interface{})
LoggerDebug logs a message with debug level. No formatting.
func LoggerDebugf ¶
LoggerDebugf logs a message with debug level. Formatting "à la" printf.
func LoggerErr ¶
func LoggerErr(l Logger, v ...interface{})
LoggerErr logs a message with error level. No formatting.
func LoggerErrf ¶
LoggerErrf logs a message with error level. Formatting "à la" printf.
func LoggerInfo ¶
func LoggerInfo(l Logger, v ...interface{})
LoggerInfo logs a message with info level. No formatting.
func LoggerInfof ¶
LoggerInfof logs a message with info level. Formatting "à la" printf.
func LoggerNotice ¶
func LoggerNotice(l Logger, v ...interface{})
LoggerNotice logs a message with notice level. No formatting.
func LoggerNoticef ¶
LoggerNoticef logs a message with notice level. Formatting "à la" printf.
func LoggerWarning ¶
func LoggerWarning(l Logger, v ...interface{})
LoggerWarning logs a message with warning level. No formatting.
func LoggerWarningf ¶
LoggerWarningf logs a message with warning level. Formatting "à la" printf.
func PriorityString ¶
PriorityString returns a readable string (English word) that corresponds to a given log priority.
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is a default implementation of the Logger interface. It basically logs informations in two places, which are the console (stderr) and syslog.
func NewLog ¶
NewLog Constructs a new log object, note that this is called under the hood by the global shared object constructor.
func (*Log) Flush ¶
func (l *Log) Flush()
Flush flushes all channels for which it makes sense to be flushed. This is automatically called if priority is CRIT, ERR, WARNING or NOTICE.
func (*Log) GetPriority ¶
GetPriority returns the priority under which message won't be displayed any more.
func (*Log) Logp ¶
Logp logs a message on all relevant channels. EOL is added at the end, you do not need to provide it.
func (*Log) Logpf ¶
Logpf logs a message on all relevant channels, using a printf-like syntax. EOL is added at the end, you do not need to provide it.
func (*Log) SetPriority ¶
SetPriority sets the priority above which message won't be displayed any more.
type Logger ¶
type Logger interface { Logp(p Priority, v ...interface{}) Logpf(p Priority, f string, v ...interface{}) SetPriority(p Priority) GetPriority() Priority Flush() }
Logger is a custom logging interface, while the package with only one implementation, the interface is technically generic, and could be implemented/used elsewhere. This is design for quick-to-write global usage, not for universality/versatility.
type Priority ¶
type Priority int
Priority is a logging priority (AKA level), the lower the number, the higher the priority.
const ( // PriorityCrit should be used for critical messages. // Inspired from /usr/include/sys/syslog.h. // We don't use EMERG and ALERT PriorityCrit Priority = iota + Priority(int(syslog.LOG_CRIT)) // PriorityErr should be used for error messages. PriorityErr // PriorityWarning should be used for warning messages. PriorityWarning // PriorityNotice should be used for notice messages. PriorityNotice // PriorityInfo should be used for information messages. PriorityInfo // PriorityDebug should be used for debugging messages. PriorityDebug )
func LogGetPriority ¶
func LogGetPriority() Priority
LogGetPriority returns the global, default logging level. Uses the default global logging backend.