vapor: github.com/ufoot/vapor/go/vplog Index | Files

package vplog

import "github.com/ufoot/vapor/go/vplog"

Package vplog contains a simple log helper which logs on both stderr and syslog.

Index

Package Files

doc.go generate.go version.go vplog.go vplogger.go

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 is the project stamp, possibly changes for each build.

func LogCrit Uses

func LogCrit(v ...interface{})

LogCrit logs a critical message, no formatting. Uses the default global logging backend.

func LogCritf Uses

func LogCritf(f string, v ...interface{})

LogCritf logs a critical message, formatting "à la" printf. Uses the default global logging backend.

func LogDebug Uses

func LogDebug(v ...interface{})

LogDebug logs a debug message, no formatting. Uses the default global logging backend.

func LogDebugf Uses

func LogDebugf(f string, v ...interface{})

LogDebugf logs a debug message, formatting "à la" printf. Uses the default global logging backend.

func LogErr Uses

func LogErr(v ...interface{})

LogErr logs an error message, no formatting. Uses the default global logging backend.

func LogErrf Uses

func LogErrf(f string, v ...interface{})

LogErrf logs an error message, formatting "à la" printf. Uses the default global logging backend.

func LogFlush Uses

func LogFlush()

LogFlush flushes the global logging system, more precisely, flushes stderr.

func LogInfo Uses

func LogInfo(v ...interface{})

LogInfo logs an information message, no formatting. Uses the default global logging backend.

func LogInfof Uses

func LogInfof(f string, v ...interface{})

LogInfof logs an information message, formatting "à la" printf. Uses the default global logging backend.

func LogInit Uses

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 Uses

func LogNotice(v ...interface{})

LogNotice logs a notice message, no formatting. Uses the default global logging backend.

func LogNoticef Uses

func LogNoticef(f string, v ...interface{})

LogNoticef logs a notice message, formatting "à la" printf. Uses the default global logging backend.

func LogSetPriority Uses

func LogSetPriority(p Priority)

LogSetPriority sets the global, default logging level. Uses the default global logging backend.

func LogWarning Uses

func LogWarning(v ...interface{})

LogWarning logs a warning message, no formatting. Uses the default global logging backend.

func LogWarningf Uses

func LogWarningf(f string, v ...interface{})

LogWarningf logs a warning message, formatting "à la" printf. Uses the default global logging backend.

func LoggerCrit Uses

func LoggerCrit(l Logger, v ...interface{})

LoggerCrit logs a message with critical level. No formatting.

func LoggerCritf Uses

func LoggerCritf(l Logger, f string, v ...interface{})

LoggerCritf logs a message with critical level. Formatting "à la" printf.

func LoggerDebug Uses

func LoggerDebug(l Logger, v ...interface{})

LoggerDebug logs a message with debug level. No formatting.

func LoggerDebugf Uses

func LoggerDebugf(l Logger, f string, v ...interface{})

LoggerDebugf logs a message with debug level. Formatting "à la" printf.

func LoggerErr Uses

func LoggerErr(l Logger, v ...interface{})

LoggerErr logs a message with error level. No formatting.

func LoggerErrf Uses

func LoggerErrf(l Logger, f string, v ...interface{})

LoggerErrf logs a message with error level. Formatting "à la" printf.

func LoggerInfo Uses

func LoggerInfo(l Logger, v ...interface{})

LoggerInfo logs a message with info level. No formatting.

func LoggerInfof Uses

func LoggerInfof(l Logger, f string, v ...interface{})

LoggerInfof logs a message with info level. Formatting "à la" printf.

func LoggerNotice Uses

func LoggerNotice(l Logger, v ...interface{})

LoggerNotice logs a message with notice level. No formatting.

func LoggerNoticef Uses

func LoggerNoticef(l Logger, f string, v ...interface{})

LoggerNoticef logs a message with notice level. Formatting "à la" printf.

func LoggerWarning Uses

func LoggerWarning(l Logger, v ...interface{})

LoggerWarning logs a message with warning level. No formatting.

func LoggerWarningf Uses

func LoggerWarningf(l Logger, f string, v ...interface{})

LoggerWarningf logs a message with warning level. Formatting "à la" printf.

func PriorityString Uses

func PriorityString(p Priority) string

PriorityString returns a readable string (English word) that corresponds to a given log priority.

type Log Uses

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 Uses

func NewLog(program string) *Log

NewLog Constructs a new log object, note that this is called under the hood by the global shared object constructor.

func (*Log) Flush Uses

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 Uses

func (l *Log) GetPriority() Priority

GetPriority returns the priority under which message won't be displayed any more.

func (*Log) Logp Uses

func (l *Log) Logp(p Priority, v ...interface{})

Logp logs a message on all relevant channels. EOL is added at the end, you do not need to provide it.

func (*Log) Logpf Uses

func (l *Log) Logpf(p Priority, format string, v ...interface{})

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 Uses

func (l *Log) SetPriority(p Priority)

SetPriority sets the priority above which message won't be displayed any more.

type Logger Uses

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 Uses

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 Uses

func LogGetPriority() Priority

LogGetPriority returns the global, default logging level. Uses the default global logging backend.

Package vplog imports 8 packages (graph) and is imported by 8 packages. Updated 2016-11-06. Refresh now. Tools for package owners.