env

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppName holds the name of this application
	AppName = "phronetic"
)

Variables

View Source
var (
	// ConfigFile - keeps full path to the configuration file
	ConfigFile string
)

Functions

func Config

func Config() *viper.Viper

Config returns pointer to the viper config

func InitConfig

func InitConfig() (err error)

InitConfig initializes application's configuration

func InitLogger

func InitLogger()

InitLogger initializes stderr and logger to file

func NewLogFileHook

func NewLogFileHook(config LogFileConfig) (logrus.Hook, error)

NewLogFileHook instantiates hook and implements Hook interface

Types

type ConsoleWriterHook

type ConsoleWriterHook struct {
	Writer    io.Writer
	LogLevels []logrus.Level
	Formatter logrus.Formatter
}

ConsoleWriterHook is a hook that writes logs of specified LogLevels to specified Writer

func (*ConsoleWriterHook) Fire

func (hook *ConsoleWriterHook) Fire(entry *logrus.Entry) error

Fire will be called when some logging function is called with current hook It will format log entry to string and write it to appropriate writer

func (*ConsoleWriterHook) Levels

func (hook *ConsoleWriterHook) Levels() []logrus.Level

Levels define on which log levels this hook would trigger

type LogFileConfig

type LogFileConfig struct {
	Filename  string
	MaxSize   int
	Level     logrus.Level
	Formatter logrus.Formatter
}

LogFileConfig keeps configuration settings required for lumberjack

type LogFileHook

type LogFileHook struct {
	Config LogFileConfig
	// contains filtered or unexported fields
}

LogFileHook structure implements logfile hook for logrus

func (*LogFileHook) Fire

func (hook *LogFileHook) Fire(entry *logrus.Entry) (err error)

Fire implements actual write()

func (*LogFileHook) Levels

func (hook *LogFileHook) Levels() []logrus.Level

Levels defines and returns the log levels under which logrus fires the "Fire"

Jump to

Keyboard shortcuts

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