tchap / zap-logger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zap Logger

Zap logger is the Zap logger for Casbin. With this library, Casbin can log information more powerful.

Installation

go get github.com/casbin/zap-logger

How to use it

You could let your enforcer use this logger when you first initialize your enforcer like:

e, _ := casbin.NewEnforcer("examples/rbac_model.conf", a, zaplogger.NewLogger(true, true), true)

or with and existing zap instance.

logger := zaplogger.NewLoggerByZap(yourZapLogger, true)
e, _ := casbin.NewEnforcer("examples/rbac_model.conf", a, logger, true)

And the method NewLogger have two params: enabled and jsonEncode, you could initialize logger's log status and decide whether to output information with json encoded or not.

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.

About

License:Apache License 2.0


Languages

Language:Go 100.0%