Git Product home page Git Product logo

zap-prettyconsole's People

Contributors

thessem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

zap-prettyconsole's Issues

Formatting newlines (eg in large SQL queries)

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 โœจ

With doesn't work

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"}

https://go.dev/play/p/IVPYVYRduhC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.