log

package
Version: v0.0.0-...-2443ee7 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 9 Imported by: 0

README

log

log initialization lib for logrus.

log.Init(&log.Config{Level: "info"})
logrus.WithFields(logrus.Fields{
    "api": "/user",
}).Info("success")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(c *Config) error

Init initialize logrus to your weapon of choice

Types

type Config

type Config struct {
	Level           string `json:"level" yaml:"level"`                       // Log level
	Path            string `json:"path" yaml:"path"`                         // Log path
	Filename        string `json:"filename" yaml:"filename"`                 // Log filename
	MaxAge          int    `json:"max_age" yaml:"max_age"`                   // Log store time
	RotationTime    int    `json:"rotation_time" yaml:"rotation_time"`       // Log rotation time
	ReportCaller    bool   `json:"report_caller" yaml:"report_caller"`       // Report caller func and line number
	TimestampFormat string `json:"timestamp_format" yaml:"timestamp_format"` // Timestamp Format
	LogrusLevel     logrus.Level
	// contains filtered or unexported fields
}

Config for log config

func (*Config) Check

func (c *Config) Check() error

Check validates config

Source Files

Jump to

Keyboard shortcuts

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