https://github.com/dreamph/logc
Dynamic Golang Logger (Zap, ZeroLog)
https://github.com/dreamph/logc
golang logger logging zap zerolog
Last synced: 3 months ago
JSON representation
Dynamic Golang Logger (Zap, ZeroLog)
- Host: GitHub
- URL: https://github.com/dreamph/logc
- Owner: dreamph
- License: mit
- Created: 2025-01-02T09:27:43.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-10T15:12:40.000Z (4 months ago)
- Last Synced: 2025-01-10T16:26:28.683Z (4 months ago)
- Topics: golang, logger, logging, zap, zerolog
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# logc
Golang Logger Wrapper
- Easy for change Log Library Support (zap, zerolog)
- Simple & EasyInstall
=======
``` sh
go get github.com/dreamph/logc
```Examples - Use Zap
=======
``` go
package mainimport (
"context"
"github.com/dreamph/logc"
"github.com/dreamph/logc/zap"
)func main() {
logger := zap.NewLogger(&logc.Options{
FilePath: "./app.log",
Level: "debug",
Format: "json",
MaxAge: 30,
MaxSize: 10,
})
defer logger.Release()logger.Info("Test Info")
logger.Warn("Test Warn")d := map[string]interface{}{
"requestId": "123",
}
log := logger.WithLogger(logc.WithValue(context.Background(), d))
log.Info("Test")}
```Examples - Use ZeroLog
=======
``` go
package mainimport (
"context"
"github.com/dreamph/logc"
"github.com/dreamph/logc/zerolog"
)func main() {
logger := zerolog.NewLogger(&logc.Options{
FilePath: "./app.log",
Level: "debug",
Format: "json",
MaxAge: 30,
MaxSize: 10,
})
defer logger.Release()logger.Info("Test Info")
logger.Warn("Test Warn")d := map[string]interface{}{
"requestId": "123",
}
log := logger.WithLogger(logc.WithValue(context.Background(), d))
log.Info("Test")
}
```Buy Me a Coffee
=======
[](https://www.buymeacoffee.com/dreamph)