thessem / zap-prettyconsole Goto Github PK
View Code? Open in Web Editor NEWA structured logger with output designed to be read by humans. Implemented as a zap encoder.
License: MIT License
A structured logger with output designed to be read by humans. Implemented as a zap encoder.
License: MIT License
First off, thank you! I was so happy to see this and that it was so easy. Also, I see that part of your motivation is being a fan of error wrapping and stacktraces, which is part of why I'm currently switching out the logging code in my project.
So I wonder if there's a way to make the newlines in my pgx display? This is an example fragment:
3:02PM INF > Exec commandTag=DO pid=2930363 sql=DO $$\n BEGIN\n CREATE TABLE IF NOT EXISTS http_sessions (\n ...
Is it something that this package can do? Or is it something I need to change in pgx or zap itself? Thanks for any tips โจ
I was trying to use your project's logger and ran into this issue with zap's With
method. It seems like the prettyconsole encoder doesn't print the extra fields.
package main
import (
prettyconsole "github.com/thessem/zap-prettyconsole"
"go.uber.org/zap"
)
func main() {
pretty := zap.Must(prettyconsole.NewConfig().Build())
pretty = pretty.With(zap.String("foo", "foo"))
pretty.Debug("wtf", zap.String("bar", "bar"))
dev := zap.Must(zap.NewDevelopmentConfig().Build())
dev = dev.With(zap.String("foo", "foo"))
dev.Debug("wtf", zap.String("baz", "bar"))
}
$ go run ./
12:02PM DBG > wtf bar=bar
2022-12-01T12:02:39.113-0500 DEBUG foo/main.go:15 wtf {"foo": "foo", "baz": "bar"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.