Categorygithub.com/palano/logger
modulepackage
1.0.0
Repository: https://github.com/palano/logger.git
Documentation: pkg.go.dev

# README

logger

The modular log for log providers

Installation

go get -u github.com/palano/logger

Quick Start

// LogConfig
type LogConfig struct {
	LevelKey          string
	TimeKey           string
	MessageKey        string
	CallerKey         string
	StacktracerKey    string
	EnableCaller      bool
	EnableStacktracer bool
	EnableFileLog     bool
	FileLog           string
	MaxSize           int
	MaxBackups        int
	MaxAge            int
}

Example for :zap: Zap


import (
    "github.com/palano/logger"
    "github.com/palano/logger/zap"
)

func main() {
    lc := logger.LogConfig{}
    log := zap.New(lc)
    log.Info("Example")
    
    log.WithFields(logger.Fields{
        "content": "example",
    }).Info("Example")
}

Example for Logrus


import (
    "github.com/palano/logger"
    "github.com/palano/logger/logrus"
)

func main() {
    lc := logger.LogConfig{}
    log := logrus.New(lc)
    log.Info("Example")
    
    log.WithFields(logger.Fields{
        "content": "example",
    }).Info("Example")
}

Example for Zerolog


import (
    "github.com/palano/logger"
    "github.com/palano/logger/zerolog"
)

func main() {
    lc := logger.LogConfig{}
    log := zerolog.New(lc)
    log.Info("Example")
    
    log.WithFields(logger.Fields{
        "content": "example",
    }).Info("Example")
}

Providers

File Log Writer

License

Released under the MIT License.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Log config.

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author