v.io: v.io/v23/logging Index | Files

package logging

import "v.io/v23/logging"

Package loging defines an interface for logging modeled on Google's glog.

Index

Package Files

discard.go model.go

type ErrorLog Uses

type ErrorLog interface {
    // Error logs to the ERROR and INFO logs.
    // Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
    Error(args ...interface{})

    // ErrorDepth acts as Error but uses depth to determine which call frame to log.
    // A depth of 0 is equivalent to calling Error.
    ErrorDepth(depth int, args ...interface{})

    // Errorf logs to the ERROR and INFO logs.
    // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
    Errorf(format string, args ...interface{})
}

type FatalLog Uses

type FatalLog interface {
    // Fatal logs to the FATAL, ERROR and INFO logs,
    // including a stack trace of all running goroutines, then calls os.Exit(255).
    // Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
    Fatal(args ...interface{})

    // FatalDepth acts as Fatal but uses depth to determine which call frame to log.
    // A depth of 0 is equivalent to calling Fatal.
    FatalDepth(depth int, args ...interface{})

    // Fatalf logs to the FATAL, ERROR and INFO logs,
    // including a stack trace of all running goroutines, then calls os.Exit(255).
    // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
    Fatalf(format string, args ...interface{})
}

type InfoLog Uses

type InfoLog interface {
    // Info logs to the INFO log.
    // Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
    Info(args ...interface{})

    // Infoln logs to the INFO log.
    // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
    Infof(format string, args ...interface{})

    // InfoDepth acts as Info but uses depth to determine which call frame to log.
    // A depth of 0 is equivalent to calling Info.
    InfoDepth(depth int, args ...interface{})

    // InfoStack logs the current goroutine's stack if the all parameter
    // is false, or the stacks of all goroutines if it's true.
    InfoStack(all bool)
}

type Logger Uses

type Logger interface {
    InfoLog
    ErrorLog
    FatalLog
    PanicLog
    Verbosity
    // Flush flushes all pending log I/O.
    FlushLog()
}
var Discard Logger = &discard{}

Discard is an implementation of Logger that discards all input, the equivalent of /dev/null. Fatal*, Panic* and all management methods are also no-ops.

type PanicLog Uses

type PanicLog interface {
    // Panic is equivalent to Error() followed by a call to panic().
    Panic(args ...interface{})

    // PanicDepth acts as Panic but uses depth to determine which call frame to log.
    // A depth of 0 is equivalent to calling Panic.
    PanicDepth(depth int, args ...interface{})

    // Panicf is equivalent to Errorf() followed by a call to panic().
    Panicf(format string, args ...interface{})
}

type Verbosity Uses

type Verbosity interface {
    // V returns true if the configured logging level is greater than or equal to its parameter
    V(level int) bool

    // VDepth acts as V but uses depth to determine which call frame to test against.
    VDepth(depth int, level int) bool

    // VI is like V, except that it returns an anonymous interface that with the
    // same method set as InfoLog that will either log (if level >= the configured level)
    // or discard its parameters. This allows for logger.VI(2).Info style usage. An
    // anonymous interface is used to allow for implementations that don't need to
    // depend on this package.
    VI(level int) interface {
        // Info logs to the INFO log.
        // Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
        Info(args ...interface{})

        // Infoln logs to the INFO log.
        // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
        Infof(format string, args ...interface{})

        // InfoDepth acts as Info but uses depth to determine which call frame to log.
        // A depth of 0 is equivalent to calling Info.
        InfoDepth(depth int, args ...interface{})

        // InfoStack logs the current goroutine's stack if the all parameter
        // is false, or the stacks of all goroutines if it's true.
        InfoStack(all bool)
    }

    // VIDepth acts as VI but uses depth to determine which call frame to test against.
    VIDepth(depth int, level int) interface {
        // Info logs to the INFO log.
        // Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
        Info(args ...interface{})

        // Infoln logs to the INFO log.
        // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
        Infof(format string, args ...interface{})

        // InfoDepth acts as Info but uses depth to determine which call frame to log.
        // A depth of 0 is equivalent to calling Info.
        InfoDepth(depth int, args ...interface{})

        // InfoStack logs the current goroutine's stack if the all parameter
        // is false, or the stacks of all goroutines if it's true.
        InfoStack(all bool)
    }
}

Package logging is imported by 17 packages. Updated 2020-06-08. Refresh now. Tools for package owners.