logger

package
Version: v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package logger provides access to an implementation of v23/logger.Logging for use within a runtime implementation. There is pre-created "global" logger and the ability to create new loggers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Global

func Global() logging.Logger

Global returns the global logger.

func IsAlreadyConfiguredError

func IsAlreadyConfiguredError(err error) bool

IsAlreadyConfiguredError returns true if the err parameter indicates the the logger has already been configured.

func NewLogger

func NewLogger(name string) logging.Logger

NewLogger creates a new logger with the supplied name.

Types

type ManageLog

type ManageLog interface {

	// LogDir returns the directory where the log files are written.
	LogDir() string

	// Stats returns stats on how many lines/bytes haven been written to
	// this set of logs.
	Stats() (Info, Error struct{ Lines, Bytes int64 })

	// ConfigureLoggerFromFlags will configure the supplied logger using
	// command line flags.
	ConfigureFromFlags(opts ...vlog.LoggingOpts) error

	// ConfigureFromArgs will configure the supplied logger using the supplied
	// arguments.
	ConfigureFromArgs(opts ...vlog.LoggingOpts) error

	// ExplicitlySetFlags returns a map of the logging command line flags and their
	// values formatted as strings.  Only the flags that were explicitly set are
	// returned. This is intended for use when an application needs to know what
	// value the flags were set to, for example when creating subprocesses.
	ExplicitlySetFlags() map[string]string
}

ManageLog defines the methods for managing and configuring a logger.

func Manager

func Manager(logger logging.Logger) ManageLog

Manager determines if the supplied logging.Logger implements ManageLog and if so returns an instance of it. If it doesn't implement ManageLog then Manager will return a dummy implementation that is essentially a no-op. It is always safe to use it as: logger.Manager(logger.Global()).LogDir() for example.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL