go-agent: github.com/sqreen/go-agent/agent/internal/plog Index | Files

package plog

import "github.com/sqreen/go-agent/agent/internal/plog"


Package Files



const (
    DisabledString = "disabled"
    ErrorString    = "error"
    InfoString     = "info"
    DebugString    = "debug"

String representations of log levels.

const TimestampLayout = "2006-01-02T15:04:05.999999"

Time formatting layout with microsecond precision.

type DebugLogger Uses

type DebugLogger interface {
    Debug(v ...interface{})
    Debugf(format string, v ...interface{})

type ErrorLogger Uses

type ErrorLogger interface {
    Error(err error)

type InfoLogger Uses

type InfoLogger interface {
    Info(v ...interface{})
    Infof(format string, v ...interface{})

type LogLevel Uses

type LogLevel int

LogLevel represents the log level. Higher levels include lowers.

const (
    // Disabled value.
    Disabled LogLevel = iota
    // Error logs.
    // Info to Error logs.
    // Debug to Error logs.

func ParseLogLevel Uses

func ParseLogLevel(level string) LogLevel

ParseLogLevel returns the logger level corresponding to the string representation `level`. The returned LogLevel is Disabled when none matches.

func (LogLevel) String Uses

func (l LogLevel) String() string

LogLevel type stringer.

type Logger Uses

type Logger struct {
    // contains filtered or unexported fields

Logger structure wrapping logger interfaces, one per level.

func NewLogger Uses

func NewLogger(level LogLevel, output io.Writer, errChanBufferLen int) *Logger

NewLogger returns a Logger instance wrapping one logger instance per level. They can thus be individually enabled or disabled.

func (*Logger) ErrChan Uses

func (l *Logger) ErrChan() <-chan error

ErrChan returns the error channel. When Error logs are produced, the logged error is sent into the channel.

func (*Logger) Error Uses

func (l *Logger) Error(err error)

Error logs the error and send it into the error channel. If the channel is full, the send operation is dropped but the logging is still produced.

Package plog imports 4 packages (graph) and is imported by 9 packages. Updated 2019-06-15. Refresh now. Tools for package owners.