prettyzerolog

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2019 License: MIT Imports: 13 Imported by: 1

README

Pretty zerolog

Prettyzerolog is a pretty logging with focus on readability, based on the zerolog.ConsoleWriter but with some added features like json pretty printing and log line separator.

It is fork from https://github.com/UnnoTed/horizontal with some fixes.

prettyzerolog

go get gitlab.com/so_literate/prettyzerolog

package main

import (
	"os"

	"github.com/rs/zerolog/log"
	"gitlab.com/so_literate/prettyzerolog"
)

type fields struct {
	Field1 string
	Field2 int
	Field3 interface{}
}

func main() {
	logger := log.Output(prettyzerolog.ConsoleWriter{Out: os.Stdout})
	logger.Debug().Msg("hello")

	f := &fields{
		Field1: "field 1",
		Field2: 2,
		Field3: true,
	}

	logger.Info().Interface("fields", f).Str("text", "some text").Msg("some fields")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleWriter

type ConsoleWriter struct {
	Out     io.Writer
	NoColor bool
}

func (ConsoleWriter) Write

func (w ConsoleWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL