Skip to content

go-haru/log-zap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-zap

Go Reference License Release Go Test Go Report Card

log-zap is wrapper of go.uber.org/zap for log

Usage

package main

import (
    "log"

    hlog "github.com/go-haru/log"

    logger "github.com/go-haru/log-zap"
)

func main() {
    var config = logger.Options{
        Level:     hlog.InfoLevel.String(),
        Format:    logger.FormatText,
        LongTime:  true,
        WithColor: true,
    }

    // build wrapped zap logger
    var zapLogger, err = logger.New(config)
    if err != nil {
        panic(err)
    }

    // register logger
    hlog.Use(zapLogger)

    // takeover sdk logger's output 
    log.SetFlags(0)
    log.SetOutput(zapLogger.
        WithLevel(hlog.InfoLevel).
        AddDepth(-1).
        Standard().Writer(),
    )
}

Contributing

For convenience of PM, please commit all issue to Document Repo.

License

This project is licensed under the Apache License Version 2.0.

Use and contributions signify your agreement to honor the terms of this LICENSE.

Commercial support or licensing is conditionally available through organization email.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages