logger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

Logger

A logger based on Zap

Installation

go get github.com/goer-project/goer-utils

Usage

l := logger.NewChannel(&logger.Channel{
    Path:    "/your-path/log.log",
    Level:   "debug",
    Days:    14,
    Console: true,
    Format: "json",
})

l.Info("This is a log.")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxBackups = 3
)

Functions

func NewChannel

func NewChannel(c *Channel) *zap.Logger

NewChannel Log channel

Types

type Channel

type Channel struct {
	Path     string `mapstructure:"path" json:"path" yaml:"path"`
	Level    string `mapstructure:"level" json:"level" yaml:"level"`
	Days     int    `mapstructure:"days" json:"days" yaml:"days"`
	Console  bool   `mapstructure:"console" json:"console" yaml:"console"`
	Format   string `mapstructure:"format" json:"format" yaml:"format"`
	MaxSize  int    `mapstructure:"max-size" json:"max_size" yaml:"max-size"`
	Compress bool   `mapstructure:"compress" json:"compress" yaml:"compress"`
}

Jump to

Keyboard shortcuts

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