clog: github.com/couchbase/clog Index | Files

package clog

import "github.com/couchbase/clog"

Index

Package Files

clog.go

Constants

const (
    LevelDebug = LogLevel(iota)
    LevelNormal
    LevelWarning
    LevelError
    LevelPanic
)
const (
    UserData = ContentCategory(iota)
    MetaData
    SystemData
)

Variables

var Level = LevelNormal

Logging package level (Setting Level directly isn't thread-safe).

func Debug Uses

func Debug(args ...interface{})

Logs a debug message to the console

func Debugf Uses

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

Logs a formatted debug message to the console

func DisableColor Uses

func DisableColor()

Disables ANSI color in log output.

func DisableKey Uses

func DisableKey(key string)

Disable logging messages sent to this key

func DisableTime Uses

func DisableTime()

Disable timestamps in logs.

func EnableKey Uses

func EnableKey(key string)

Enable logging messages sent to this key

func Error Uses

func Error(err error) error

If the error is not nil, logs error to the console. Returns the input error for easy chaining.

func Errorf Uses

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

Logs a formatted error message to the console

func Fatal Uses

func Fatal(args ...interface{})

Logs a warning to the console, then exits the process.

func Fatalf Uses

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

Logs a formatted warning to the console, then exits the process.

func Flags Uses

func Flags() int

Flags returns the output flags for clog.

func IsIncludeCaller Uses

func IsIncludeCaller() bool

Thread-safe API for indicating whether caller information is included in log output.

func KeyEnabled Uses

func KeyEnabled(key string) bool

Check to see if logging is enabled for a key

func Log Uses

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

Logs a message to the console.

func Panic Uses

func Panic(args ...interface{})

Logs a warning to the console, then panics.

func Panicf Uses

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

Logs a formatted warning to the console, then panics.

func ParseLogFlag Uses

func ParseLogFlag(flag string)

Parses a comma-separated list of log keys, probably coming from an argv flag. The key "bw" is interpreted as a call to NoColor, not a key.

func ParseLogFlags Uses

func ParseLogFlags(flags []string)

Parses an array of log keys, probably coming from a argv flags. The key "bw" is interpreted as a call to NoColor, not a key.

func Print Uses

func Print(args ...interface{})

Prints a message to the console.

func Printf Uses

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

Prints a formatted message to the console.

func SetFlags Uses

func SetFlags(flags int)

SetFlags sets the output flags for clog.

func SetIncludeCaller Uses

func SetIncludeCaller(enabled bool)

Thread-safe API for configuring whether caller information is included in log output. (default true)

func SetLevel Uses

func SetLevel(to LogLevel)

Thread-safe API for setting log level.

func SetLoggerCallback Uses

func SetLoggerCallback(k func(level, format string, args ...interface{}) string)

Set a prefix function for the log message. Prefix function is called for each log message and it returns a prefix which is logged before each message

func SetOutput Uses

func SetOutput(w io.Writer)

SetOutput sets the output destination for clog

func TEMP Uses

func TEMP(args ...interface{})

Logs a highlighted message prefixed with "TEMP". This function is intended for temporary logging calls added during development and not to be checked in, hence its distinctive name (which is visible and easy to search for before committing.)

func TEMPf Uses

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

Logs a highlighted message prefixed with "TEMP". This function is intended for temporary logging calls added during development and not to be checked in, hence its distinctive name (which is visible and easy to search for before committing.)

func Tag Uses

func Tag(category ContentCategory, data interface{}) interface{}

func To Uses

func To(key string, format string, args ...interface{})

Logs a message to the console, but only if the corresponding key is true in keys.

func Warn Uses

func Warn(args ...interface{})

Logs a warning to the console

func Warnf Uses

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

Logs a formatted warning to the console

type ContentCategory Uses

type ContentCategory int32

Category that the data falls under.

type LogLevel Uses

type LogLevel int32

Log level type.

func GetLevel Uses

func GetLevel() LogLevel

Thread-safe API for fetching log level.

Package clog imports 8 packages (graph) and is imported by 45 packages. Updated 2018-01-25. Refresh now. Tools for package owners.