src

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const FiltersFormat string = `([a-z]+)\((.*?)\)`

FiltersFormat must filter key format

View Source
const FunctionsFormat string = `%{([a-z]+)(?::(.*?[^\\]))?}`

FunctionsFormat must function key format

Variables

This section is empty.

Functions

func Filter

func Filter(name, args string, value interface{}) interface{}

Filter rewrite value by filter

func Function

func Function(name string, level Level, options Options, message ...interface{}) interface{}

Function return interface from logger library functions

Types

type Color

type Color int

Color color available

func (Color) ToString

func (c Color) ToString() string

ToString return value

type Format

type Format string

Format logger output format

const (
	DefaultFormat Format = "%{color}%{severity:substring(0:4)}[%{datetime}]%{reset} %{message}"
)

func EnvFormat

func EnvFormat() Format

EnvFormat get from environment format value

func (Format) Parse

func (f Format) Parse(level Level, options Options, message ...interface{}) interface{}

Parse format output

type Level

type Level int

Level logger available

const (
	LevelDefault   Level = 0   // The log entry has no assigned severity level.
	LevelDebug     Level = 100 // Debug or trace information.
	LevelInfo      Level = 200 // Routine information, such as ongoing status or performance.
	LevelNotice    Level = 300 // Normal but significant events, such as start up, shut down, or a configuration change.
	LevelWarning   Level = 400 // Warning events might cause problems.
	LevelError     Level = 500 // Error events are likely to cause problems.
	LevelCritical  Level = 600 // Critical events cause more severe problems or outages.
	LevelAlert     Level = 700 // A person must take an action immediately.
	LevelEmergency Level = 800 // One or more systems are unusable.
)

The severity of the event described in a log entry, expressed as one of the standard severity levels listed below. For your reference, the levels are assigned the listed numeric values. The effect of using numeric values other than those listed is undefined. @see: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity

func EnvLevel

func EnvLevel() (Level, error)

EnvLevel get from environment level value

func ParseLevel

func ParseLevel(lvl string) (Level, error)

ParseLevel convert string level value to interface

func (Level) Color

func (l Level) Color() string

Color return specific color value

func (Level) ToString

func (l Level) ToString() string

ToString return human readable value

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options Set logger options

func DefaultOptions

func DefaultOptions() Options

DefaultOptions logger default options

func (Options) DisableColor

func (o Options) DisableColor()

DisableColor to logger

func (Options) EnableColor

func (o Options) EnableColor()

EnableColor to logger

func (Options) HasColor

func (o Options) HasColor() bool

HasColor return if color enable

Jump to

Keyboard shortcuts

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