log15setup

package
v0.0.0-...-cebcfcd Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

log15setup

This package contains default example setup utilizing Rollbar error handler.

If you want to customize it, simply copy the code from init file and make your changes.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReName = regexp.MustCompile(`^[[:alnum:]\-_.]{2,200}`)

ReName is a regular which tests valid app name for logger configuration

Functions

func CheckAppName

func CheckAppName(name, what string) error

CheckAppName validates the application name against `ReName` `what` is the an optional argument to specify name category / family.

func Configure

func Configure(name string, c Config, rc rollbar.Config) (log15.Logger, error)

Configure setups the root logger. If the logger `name` is already registered then it's upgraded according to given config.

func MustAppName

func MustAppName(name, what string)

MustAppName validates if `name` matches `ReName` and panics (through logger.Fail) if it doesn't match.

func MustLogger

func MustLogger(envName, appname, version, rollbartoken, timeFmt, level string, colored bool)

MustLogger setups logger. It panics when the provided configuration is malformed. envName is the name of running environment; eg: localhost, qa, stagging, prod...

Types

type Config

type Config struct {
	Color   bool   `yaml:"color"`
	TimeFmt string `yaml:"timeFmt"` // one of timeFMT values
	Level   string `yaml:"level"`
	// contains filtered or unexported fields
}

Config represents log config

func (*Config) Check

func (c *Config) Check() error

Check validates the config content

Jump to

Keyboard shortcuts

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