Blazing fast, structured, leveled logging in Go.

Overview

zap GoDoc Build Status Coverage Status

Blazing fast, structured, leveled logging in Go.

Installation

go get -u go.uber.org/zap

Note that zap only supports the two most recent minor versions of Go.

Quick Start

In contexts where performance is nice, but not critical, use the SugaredLogger. It's 4-10x faster than other structured logging packages and includes both structured and printf-style APIs.

logger, _ := zap.NewProduction()
defer logger.Sync() // flushes buffer, if any
sugar := logger.Sugar()
sugar.Infow("failed to fetch URL",
  // Structured context as loosely typed key-value pairs.
  "url", url,
  "attempt", 3,
  "backoff", time.Second,
)
sugar.Infof("Failed to fetch URL: %s", url)

When performance and type safety are critical, use the Logger. It's even faster than the SugaredLogger and allocates far less, but it only supports structured logging.

logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("failed to fetch URL",
  // Structured context as strongly typed Field values.
  zap.String("url", url),
  zap.Int("attempt", 3),
  zap.Duration("backoff", time.Second),
)

See the documentation and FAQ for more details.

Performance

For applications that log in the hot path, reflection-based serialization and string formatting are prohibitively expensive — they're CPU-intensive and make many small allocations. Put differently, using encoding/json and fmt.Fprintf to log tons of interface{}s makes your application slow.

Zap takes a different approach. It includes a reflection-free, zero-allocation JSON encoder, and the base Logger strives to avoid serialization overhead and allocations wherever possible. By building the high-level SugaredLogger on that foundation, zap lets users choose when they need to count every allocation and when they'd prefer a more familiar, loosely typed API.

As measured by its own benchmarking suite, not only is zap more performant than comparable structured logging packages — it's also faster than the standard library. Like all benchmarks, take these with a grain of salt.1

Log a message and 10 fields:

Package Time Time % to zap Objects Allocated
zap 862 ns/op +0% 5 allocs/op
zap (sugared) 1250 ns/op +45% 11 allocs/op
zerolog 4021 ns/op +366% 76 allocs/op
go-kit 4542 ns/op +427% 105 allocs/op
apex/log 26785 ns/op +3007% 115 allocs/op
logrus 29501 ns/op +3322% 125 allocs/op
log15 29906 ns/op +3369% 122 allocs/op

Log a message with a logger that already has 10 fields of context:

Package Time Time % to zap Objects Allocated
zap 126 ns/op +0% 0 allocs/op
zap (sugared) 187 ns/op +48% 2 allocs/op
zerolog 88 ns/op -30% 0 allocs/op
go-kit 5087 ns/op +3937% 103 allocs/op
log15 18548 ns/op +14621% 73 allocs/op
apex/log 26012 ns/op +20544% 104 allocs/op
logrus 27236 ns/op +21516% 113 allocs/op

Log a static string, without any context or printf-style templating:

Package Time Time % to zap Objects Allocated
zap 118 ns/op +0% 0 allocs/op
zap (sugared) 191 ns/op +62% 2 allocs/op
zerolog 93 ns/op -21% 0 allocs/op
go-kit 280 ns/op +137% 11 allocs/op
standard library 499 ns/op +323% 2 allocs/op
apex/log 1990 ns/op +1586% 10 allocs/op
logrus 3129 ns/op +2552% 24 allocs/op
log15 3887 ns/op +3194% 23 allocs/op

Development Status: Stable

All APIs are finalized, and no breaking changes will be made in the 1.x series of releases. Users of semver-aware dependency management systems should pin zap to ^1.

Contributing

We encourage and support an active, healthy community of contributors — including you! Details are in the contribution guide and the code of conduct. The zap maintainers keep an eye on issues and pull requests, but you can also report any negative conduct to [email protected]. That email list is a private, safe space; even the zap maintainers don't have access, so don't hesitate to hold us to a high standard.


Released under the MIT License.

1 In particular, keep in mind that we may be benchmarking against slightly older versions of other packages. Versions are pinned in the benchmarks/go.mod file.

Comments
  • Unable to install

    Unable to install

    I am getting error though installation:

    go get -u go.uber.org/zap    
    package go.uber.org/zap: unrecognized import path "go.uber.org/zap" (parse https://go.uber.org/zap?go-get=1: no go-import meta tags ())
    

    Seems you don't provide meta on go.uber.org/zap

    opened by m1ome 33
  • Add buffering wrapper around WriteSyncer

    Add buffering wrapper around WriteSyncer

    Fixes #663

    This change adds Buffer, which wraps a WriteSyncer with buffering. This use bufio.Writer to buffer in-memory, and flush changes periodically (or when the buffer is full). The Sync method forces an immediate flush.

    This can improve performance by amortizing any fixed overheads of the underlying WriteSyncer.

    bechmark result

    Running tool: /usr/local/opt/go/libexec/bin/go test -benchmem -run=^$ go.uber.org/zap/zapcore -bench ^(BenchmarkMultiWriteSyncer|BenchmarkWriteSyncer)$
    
    goos: darwin
    goarch: amd64
    pkg: go.uber.org/zap/zapcore
    BenchmarkMultiWriteSyncer/2_discarder-4         	41213204	        66.5 ns/op	      16 B/op	       1 allocs/op
    BenchmarkMultiWriteSyncer/4_discarder-4         	19545279	        72.0 ns/op	      16 B/op	       1 allocs/op
    BenchmarkMultiWriteSyncer/4_discarder_with_buffer-4         	 8759560	       143 ns/op	      16 B/op	       1 allocs/op
    BenchmarkWriteSyncer/write_file_with_no_buffer-4            	  160742	      9367 ns/op	      16 B/op	       1 allocs/op
    BenchmarkWriteSyncer/write_file_with_buffer-4               	 7559112	       198 ns/op	      16 B/op	       1 allocs/op
    PASS
    ok  	go.uber.org/zap/zapcore	12.013s
    Success: Benchmarks passed.
    
    opened by hnlq715 22
  • write error: sync /dev/stdout: invalid argument

    write error: sync /dev/stdout: invalid argument

    Thanks for opensourcing this library!

    Everything is fine during program execution, but when the application shuts down (due to an error) zap logs to stderr: write error: sync /dev/stdout: invalid argument

    Output:

    2017-02-20T17:25:14.708+0100	info	starting
    2017-02-20T17:25:14.708+0100	info	publishing	{"port": 8080}
    2017-02-20T17:45:54.522+0100	fatal	Error publishing the API	{"error": "listen tcp :8080: bind: address already in use"}
    2017-02-20 17:25:14.708574765 +0100 CET write error: sync /dev/stdout: invalid argument
    exit status 1
    

    Relevant set-up code:

    config.FileLoggingEnabled = false
    config.EncodeLogsAsJson = false
    ...
    encCfg := zapcore.EncoderConfig{
    	TimeKey:        "@timestamp",
    	LevelKey:       "level",
    	NameKey:        "logger",
    	CallerKey:      "caller",
    	MessageKey:     "msg",
    	StacktraceKey:  "stacktrace",
    	EncodeLevel:    zapcore.LowercaseLevelEncoder,
    	EncodeTime:     zapcore.ISO8601TimeEncoder,
    	EncodeDuration: zapcore.NanosDurationEncoder,
    }
    ...
    func Configure() {
    	writers := []zapcore.WriteSyncer{os.Stdout}
    	if config.FileLoggingEnabled {
    		writers = append(writers, newRollingFile(....))
    	}
            GlobalLogger = newZapLogger(config.EncodeLogsAsJson, zapcore.NewMultiWriteSyncer(writers...))
    }
    
    func newZapLogger(encodeAsJSON bool, output zapcore.WriteSyncer) *zap.Logger {
    	encoder := zapcore.NewConsoleEncoder(encoderCfg)
    	if encodeAsJSON {
    		encoder = zapcore.NewJSONEncoder(encoderCfg)
    	}
    	return zap.New(zapcore.NewCore(encoder, output, zap.NewAtomicLevel()))
    }
    
    bug question 
    opened by toefel18 19
  • Import path changed

    Import path changed

    package github.com/uber-go/zap imports go.uber.org/zap/internal/bufferpool: use of internal package not allowed package github.com/uber-go/zap imports go.uber.org/zap/internal/multierror: use of internal package not allowed

    seems github.com/zap has dependent in internal package in go.uber.org . Are you going to move this package to there?

    question 
    opened by arthurkiller 17
  • Elegant way to filter fields?

    Elegant way to filter fields?

    Hi, I've been working with zap and it's great, but I have a question that I haven't been able to solve in a few days' time.

    How can I filter out certain fields? Preferably by name (and possibly type). For example, I want to mask IP addresses in fields called "remote_addr" or strip fields called "password".

    I've tried making an Encoder and wrapped EncodeEntry() and this works, but not for complex types like objects and arrays. In other words, if a log adds a field with zap.Object("http_request", req), EncodeEntry() has no way to peer inside the object and find offending fields and filter them ... does it?

    I've also tried implementing AddString() and AddObject() on my Encoder type but then the object loses its structure, and all its fields are flatted into the top level of the context.

    Any ideas how this can be done?

    It is important for regulatory/compliance reasons, apparently.

    opened by mholt 16
  • Don't panic when a given field value is nil

    Don't panic when a given field value is nil

    Ideally a logging framework doesn't cause a panic for code like this:

    foo, err := getFoo()
    
    if err != nil {
       log.Error("Couldn't acquire foo", zap.Error(err))
    }
    
    // foo could be nil here
    log = log.With(zap.Stringer("foo", foo))
    
    bar, err := getBar()
    
    if err != nil {
      // panics
      log.Error("Couldn't acquire bar", zap.Error(err))
    }
    

    This is probably also fixing #495 and #528

    opened by joa 16
  • Add grpclog.LoggerV2 logger

    Add grpclog.LoggerV2 logger

    Fixed V() implementation based on https://github.com/uber-go/zap/pull/538.

    Official grpclog.LoggerV2 implementation sets verbose level at initialization. So I adopt functional option to set verbose level.

    opened by kazegusuri 15
  • provide an easy way to derive a logger that logs at a different level

    provide an easy way to derive a logger that logs at a different level

    When logging HTTP requests, we've found it useful to be able to increase the logging threshold for some requests at particular paths (for example, the trivial endpoint that the Nagios check uses) to avoid overwhelming the logs with noise.

    It's possible to do this oneself with something like the below code, but this isn't particularly obvious and probably isn't that efficient, so perhaps it might be worth adding a WithLevel method to zap.Logger.

    // in the code
    logger = logger.WithOptions(wrapCoreWithLevel(zap.WarnLevel))
    
    func wrapCoreWithLevel(level zapcore.Level) zap.Option {
    	return zap.WrapCore(func(core zapcore.Core) zapcore.Core {
    		return &coreWithLevel{
    			Core:  core,
    			level: level,
    		}
    	})
    }
    
    type coreWithLevel struct {
    	zapcore.Core
    	level zapcore.Level
    }
    
    func (c *coreWithLevel) Enabled(level zapcore.Level) bool {
    	return c.level.Enabled(level) && c.Core.Enabled(level)
    }
    
    func (c *coreWithLevel) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {
    	if !c.level.Enabled(e.Level) {
    		return ce
    	}
    	return c.Core.Check(e, ce)
    }
    
    
    opened by rogpeppe 15
  • Implementing grpclog.LoggerV2 compatible logger

    Implementing grpclog.LoggerV2 compatible logger

    Currently, go.uber.org/zap/zapgrpc.Logger only provides an implementation for grpclog.Logger. With the release of grpclog.LoggerV2, an updated implementation is needed so that go.uber.org/zap/zapgrpc.Logger implements both grpclog.Logger and grpclog.LoggerV2.

    Fixes #534

    enhancement 
    opened by frankgreco 13
  • Support for adding custom encoders

    Support for adding custom encoders

    I would like a way to add custom encoders using the config here. There is an Encoding option here that allows both console and json to be used.

    I had previously made a custom encoder from a previous development version of this library. While I haven't yet updated that library to work with the current release candidate, a hook that would allow me to add something like this into the library would be nice.

    func NewLogfmtEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
            // instantiate the logfmt encoder here
    }
    
    func init() {
            zap.RegisterEncoder("logfmt", NewLogfmtEncoder)
    }
    

    It doesn't need to be very complicated. It can just be a map protected by a global read/write mutex (or not even that since loggers should be registered in init() functions) that panics whenever there is a duplicate. I'm thinking something similar to how database/sql allows additional database handlers.

    enhancement 
    opened by jsternberg 13
  • Skip runtime and some zap frames in stacktraces

    Skip runtime and some zap frames in stacktraces

    Remove runtime.goexit, runtime.main, and some zap frames from our stacktraces. Since we're now formatting our own traces, we also get a big performance win: nearly 5x faster and half the number of bytes allocated!

    Current master:

    BenchmarkStackField-4             200000              9587 ns/op             960 B/op          2 allocs/op
    

    After this PR:

    BenchmarkStackField-4             500000              2149 ns/op             448 B/op          2 allocs/op
    

    Fixes #308.

    opened by bufdev 13
  • provides an option to turn off errorVerbose output

    provides an option to turn off errorVerbose output

    Please provide a way where we can turn off the errorVerbose output!

    When I print pkg/errors, it prints errorVerbose, which is quite confusing, since StackTrace is provided, why should it output the stack trace of error

    The output of errorVerbose is rather messy and not easy to read, which should not be forced on the user!

    opened by OldSmokeGun 0
  • Adding a key value pair encoder.

    Adding a key value pair encoder.

    Is your feature request related to a problem? Please describe. For log processing applications like sumologic, key value pair encoding is fastest. I want to raise an MR for keyvalue encoder, over the ones that are already available: json and console.

    Describe the solution you'd like I can raise a PR for this new encoder.

    Describe alternatives you've considered Currently people have to copy paste code of json encoder and implement all it's code, as it is not exported.

    Is this a breaking change? no

    opened by vorishirne 0
  • There should be a hard limit on the maximum buffer to place back in the sync.pool

    There should be a hard limit on the maximum buffer to place back in the sync.pool

    Describe the bug

    func (b *Buffer) Free() { b.pool.put(b) } To avoid memory problem, there should be a hard limit on the maximum buffer to place back in the sync.pool // See https://golang.org/issue/23199

    opened by WOODNOTWOODY 0
  • Refactor to reuse Log method

    Refactor to reuse Log method

    This refactors the implementation of the Log method to reuse it in the other level variants of the method (i.e. Debug, Info, etc.).

    To do this, a skip argument was added to check to allow its callers to specify how many frames to skip in the log, and a private log method was added which calls this check method with the appropriate frame skip count.

    opened by sywhang 1
  • Feature Request: Add support for `netip` `Addr` and `AddrPort` value types

    Feature Request: Add support for `netip` `Addr` and `AddrPort` value types

    In Go 1.18, new read/write methods were added to net.UDPConn to take advantage of the new netip value types. I updated my code to use these new methods. But the expected savings fail to manifest, because for debug and error logs I had to pass the returned netip.AddrPort value to zap as Stringer, which leads the Go compiler to allocate them on the heap.

    It'd be nice if zap has support for these new types. But I could see the difficulty of retrofitting these types into the Field struct.

    opened by database64128 1
Releases(v1.23.0)
  • v1.23.0(Aug 24, 2022)

    Enhancements:

    • #1147: Add a zapcore.LevelOf function to determine the level of a LevelEnabler or Core.
    • #1155: Add zap.Stringers field constructor to log arrays of objects that implement String() string.
    Source code(tar.gz)
    Source code(zip)
  • v1.22.0(Aug 8, 2022)

    Enhancements:

    • #1071: Add zap.Objects and zap.ObjectValues field constructors to log arrays of objects. With these two constructors, you don't need to implement zapcore.ArrayMarshaler for use with zap.Array if those objects implement zapcore.ObjectMarshaler.
    • #1079: Add SugaredLogger.WithOptions to build a copy of an existing SugaredLogger with the provided options applied.
    • #1080: Add *ln variants to SugaredLogger for each log level. These functions provide a string joining behavior similar to fmt.Println.
    • #1088: Add zap.WithFatalHook option to control the behavior of the logger for Fatal-level log entries. This defaults to exiting the program.
    • #1108: Add a zap.Must function that you can use with NewProduction or NewDevelopment to panic if the system was unable to build the logger.
    • #1118: Add a Logger.Log method that allows specifying the log level for a statement dynamically.

    Thanks to @cardil, @craigpastro, @sashamelentyev, @shota3506, and @zhupeijun for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.21.0(Feb 7, 2022)

    1.21.0 (7 Feb 2022)

    Enhancements:

    • #1047: Add zapcore.ParseLevel to parse a Level from a string.
    • #1048: Add zap.ParseAtomicLevel to parse an AtomicLevel from a string.

    Bugfixes:

    • #1058: Fix panic in JSON encoder when EncodeLevel is unset.

    Other changes:

    • #1052: Improve encoding performance when the AddCaller and AddStacktrace options are used together.

    Thanks to @aerosol and @Techassi for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.20.0(Jan 4, 2022)

    Enhancements:

    • #989: Add EncoderConfig.SkipLineEnding flag to disable adding newline characters between log statements.
    • #1039: Add EncoderConfig.NewReflectedEncoder field to customize JSON encoding of reflected log fields.

    Bugfixes:

    • #1011: Fix inaccurate precision when encoding complex64 as JSON.
    • #554, #1017: Close JSON namespaces opened in MarshalLogObject methods when the methods return.
    • #1033: Avoid panicking in Sampler core if thereafter is zero.

    Other changes:

    • #1028: Drop support for Go < 1.15.

    Thanks to @psrajat, @lruggieri, @sammyrnycreal for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.19.1(Sep 8, 2021)

  • v1.19.0(Aug 9, 2021)

    Enhancements:

    • #975: Avoid panicking in Sampler core if the level is out of bounds.
    • #984: Reduce the size of BufferedWriteSyncer by aligning the fields better.

    Thanks to @lancoLiu and @thockin for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.18.1(Jun 28, 2021)

  • v1.18.0(Jun 28, 2021)

    Enhancements:

    • #961: Add zapcore.BufferedWriteSyncer, a new WriteSyncer that buffers messages in-memory and flushes them periodically.
    • #971: Add zapio.Writer to use a Zap logger as an io.Writer.
    • #897: Add zap.WithClock option to control the source of time via the new zapcore.Clock interface.
    • #949: Avoid panicking in zap.SugaredLogger when arguments of *w methods don't match expectations.
    • #943: Add support for filtering by level or arbitrary matcher function to zaptest/observer.
    • #691: Comply with io.StringWriter and io.ByteWriter in Zap's buffer.Buffer.

    Thanks to @atrn0, @ernado, @heyanfu, @hnlq715, @zchee for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.17.0(May 25, 2021)

    Bugfixes:

    • #867: Encode <nil> for nil error instead of a panic.
    • #931, #936: Update minimum version constraints to address vulnerabilities in dependencies.

    Enhancements:

    • #865: Improve alignment of fields of the Logger struct, reducing its size from 96 to 80 bytes.
    • #881: Support grpclog.LoggerV2 in zapgrpc.
    • #903: Support URL-encoded POST requests to the AtomicLevel HTTP handler with the application/x-www-form-urlencoded content type.
    • #912: Support multi-field encoding with zap.Inline.
    • #913: Speed up SugaredLogger for calls with a single string.
    • #928: Add support for filtering by field name to zaptest/observer.

    Thanks to @ash2k, @FMLS, @jimmystewpot, @Oncilla, @tsoslow, @tylitianrui, @withshubh, and @wziww for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.16.0(Sep 1, 2020)

    Bugfixes:

    • #828: Fix missing newline in IncreaseLevel error messages.
    • #835: Fix panic in JSON encoder when encoding times or durations without specifying a time or duration encoder.
    • #843: Honor CallerSkip when taking stack traces.
    • #862: Fix the default file permissions to use 0666 and rely on the umask instead.
    • #854: Encode <nil> for nil Stringer instead of a panic error log.

    Enhancements:

    • #629: Added zapcore.TimeEncoderOfLayout to easily create time encoders for custom layouts.
    • #697: Added support for a configurable delimiter in the console encoder.
    • #852: Optimize console encoder by pooling the underlying JSON encoder.
    • #844: Add ability to include the calling function as part of logs.
    • #843: Add StackSkip for including truncated stacks as a field.
    • #861: Add options to customize Fatal behaviour for better testability.

    Thanks to @SteelPhase, @tmshn, @lixingwang, @wyxloading, @moul, @segevfiner, @andy-retailnext and @jcorbin for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.15.0(Apr 24, 2020)

    Bugfixes:

    • #804: Fix handling of Time values out of UnixNano range.
    • #812: Fix IncreaseLevel being reset after a call to With.

    Enhancements:

    • #806: Add WithCaller option to supersede the AddCaller option. This allows disabling annotation of log entries with caller information if previously enabled with AddCaller.
    • #813: Deprecate NewSampler constructor in favor of NewSamplerWithOptions which supports a SamplerHook option. This option adds support for monitoring sampling decisions through a hook.

    Thanks to @danielbprice for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.14.1(Mar 15, 2020)

    Bugfixes:

    • #791: Fix panic on attempting to build a logger with an invalid Config.
    • #795: Vendoring Zap with go mod vendor no longer includes Zap's development-time dependencies.
    • #799: Fix issue introduced in 1.14.0 that caused invalid JSON output to be generated for arrays of time.Time objects when using string-based time formats.

    Thanks to @YashishDua for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.14.0(Feb 20, 2020)

    Enhancements:

    • #771: Optimize calls for disabled log levels.
    • #773: Add millisecond duration encoder.
    • #775: Add option to increase the level of a logger.
    • #786: Optimize time formatters using Time.AppendFormat where possible.

    Thanks to @caibirdme for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.13.0(Nov 13, 2019)

    Enhancements:

    • #758: Add Intp, Stringp, and other similar *p field constructors to log pointers to primitives with support for nil values.

    Thanks to @jbizzle for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Oct 30, 2019)

  • v1.11.0(Oct 21, 2019)

    Enhancements:

    • #725: Add zapcore.OmitKey to omit keys in an EncoderConfig.
    • #736: Add RFC3339 and RFC3339Nano time encoders.

    Thanks to @juicemia, @uhthomas for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Apr 30, 2019)

    Bugfixes:

    • #657: Fix MapObjectEncoder.AppendByteString not adding value as a string.
    • #706: Fix incorrect call depth to determine caller in Go 1.12.

    Enhancements:

    • #610: Add zaptest.WrapOptions to wrap zap.Option for creating test loggers.
    • #675: Don't panic when encoding a String field.
    • #704: Disable HTML escaping for JSON objects encoded using the reflect-based encoder.

    Thanks to @iaroslav-ciupin, @lelenanam, @joa, @NWilson for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.9.1(Aug 6, 2018)

  • v1.9.0(Jul 19, 2018)

    Enhancements:

    • #602: Reduce number of allocations when logging with reflection.
    • #572, #606: Expose a registry for third-party logging sinks.

    Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and @dimroc for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(Apr 13, 2018)

    Enhancements:

    • #508: Make log level configurable when redirecting the standard library's logger.
    • #518: Add a logger that writes to a *testing.TB.
    • #577: Add a top-level alias for zapcore.Field to clean up GoDoc.

    Bugfixes:

    • #574: Add a missing import comment to go.uber.org/zap/buffer.

    Thanks to @DiSiqueira and @djui for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Sep 25, 2017)

  • v1.7.0(Sep 21, 2017)

    Enhancements:

    • #439: Add NewStdLogAt, which extends NewStdLog by allowing the user to specify the level of the logged messages.

    Thanks to @delicb for contributing to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Aug 31, 2017)

  • v1.5.0(Jul 23, 2017)

    Enhancements:

    • #460 and #470: Support errors produced by go.uber.org/multierr.
    • #465: Support user-supplied encoders for logger names.

    Bugfixes:

    • #477: Fix a bug that incorrectly truncated deep stacktraces.

    Thanks to @richard-tunein and @pavius for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Jun 8, 2017)

  • v1.4.0(May 12, 2017)

    This release adds a few small features and is fully backward-compatible.

    Enhancements:

    • #424: Add a LineEnding field to EncoderConfig, allowing users to override the Unix-style default.
    • #425: Preserve time zones when logging times.
    • #431: Make zap.AtomicLevel implement fmt.Stringer, which makes a variety of operations a bit simpler.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Apr 25, 2017)

    This release adds an enhancement to zap's testing helpers as well as the ability to marshal an AtomicLevel. It is fully backward-compatible.

    Enhancements:

    • #415: Add a substring-filtering helper to zap's observer. This is particularly useful when testing the SugaredLogger.
    • #416: Make AtomicLevel implement encoding.TextMarshaler.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Apr 14, 2017)

    This release adds a gRPC compatibility wrapper. It is fully backward-compatible.

    Enhancements:

    • #402: Add a zapgrpc package that wraps zap's Logger and implements grpclog.Logger.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Mar 31, 2017)

    This release fixes two bugs and adds some enhancements to zap's testing helpers. It is fully backward-compatible.

    Bugfixes:

    • #385: Fix caller path trimming on Windows.
    • #396: Fix a panic when attempting to use non-existent directories with zap's configuration struct.

    Enhancements:

    • #386: Add filtering helpers to zaptest's observing logger.

    Thanks to @moitias for contributing to this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Mar 15, 2017)

    This is zap's first stable release. All exported APIs are now final, and no further breaking changes will be made in the 1.x release series.

    Anyone using a semver-aware dependency manager should now pin to ^1.

    Breaking changes:

    • #366: Add byte-oriented APIs to encoders to log UTF-8 encoded text without casting from []byte to string.
    • #364: To support buffering outputs, add Sync methods to zapcore.Core, zap.Logger, and zap.SugaredLogger.
    • #371: Rename the testutils package to zaptest, which is less likely to clash with other testing helpers.

    Bugfixes:

    • #362: Make the ISO8601 time formatters fixed-width, which is friendlier for tab-separated console output.
    • #369: Remove the automatic locks in zapcore.NewCore, which allows zap to work with concurrency-safe WriteSyncer implementations.
    • #347: Stop reporting errors when trying to fsync standard out on Linux systems.
    • #373: Report the correct caller from zap's standard library interoperability wrappers.

    Enhancements:

    • #348: Add a registry allowing third-party encodings to work with zap's built-in Config.
    • #327: Make the representation of logger callers configurable (like times, levels, and durations).
    • #376: Allow third-party encoders to use their own buffer pools, which removes the last performance advantage that zap's encoders have over plugins.
    • #346: Add CombineWriteSyncers, a convenience function to tee multiple WriteSyncers and lock the result.
    • #365: Make zap's stacktraces compatible with mid-stack inlining (coming in Go 1.9).
    • #372: Export zap's observing logger as zaptest/observer. This makes it easier for particularly punctilious users to unit test their application's logging.

    Thanks to @suyash, @htrendev, @flisky, @Ulexus, and @skipor for their contributions to this release.

    Source code(tar.gz)
    Source code(zip)
Owner
Uber Go
Uber's open source software for Go development
Uber Go
Tiny structured logging abstraction or facade for various logging libraries, allowing the end user to plug in the desired logging library in main.go

Tiny structured logging abstraction or facade for various logging libraries, allowing the end user to plug in the desired logging library in main.go.

Jacek Olszak 12 Jul 30, 2022
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

gomol Gomol (Go Multi-Output Logger) is an MIT-licensed structured logging library for Go. Gomol grew from a desire to have a structured logging libra

Kristin Davidson 19 Sep 26, 2022
Simple, customizable, leveled and efficient logging in Go

log Simple, customizable, leveled and efficient logging in Go Installation go get -u github.com/ermanimer/log Features log is a simple logging package

Erman İmer 21 Dec 20, 2021
Simple and blazing fast lockfree logging library for golang

glg is simple golang logging library Requirement Go 1.11 Installation go get github.com/kpango/glg Example package main import ( "net/http" "time"

Yusuke Kato 170 Sep 1, 2022
Structured logging package for Go.

Package log implements a simple structured logging API inspired by Logrus, designed with centralization in mind. Read more on Medium. Handlers apexlog

Apex 1.3k Sep 23, 2022
Simple, configurable and scalable Structured Logging for Go.

log Log is a simple, highly configurable, Structured Logging library Why another logging library? There's allot of great stuff out there, but also tho

Go Playgound 283 Sep 26, 2022
Structured, composable logging for Go

log15 Package log15 provides an opinionated, simple toolkit for best-practice logging in Go (golang) that is both human and machine readable. It is mo

Alan Shreve 1.1k Sep 21, 2022
Structured, pluggable logging for Go.

Logrus Logrus is a structured logger for Go (golang), completely API compatible with the standard library logger. Logrus is in maintenance-mode. We wi

Simon Eskildsen 21.4k Sep 26, 2022
Structured Logging Made Easy

Structured Logging Made Easy Features Dependency Free Simple and Clean Interface Consistent Writer IOWriter, io.Writer wrapper FileWriter, rotating &

phuslu 452 Sep 28, 2022
Logrus is a structured, pluggable logging for Go.

Logrus is a structured logger for Go (golang), completely API compatible with the standard library logger.

Simon Eskildsen 274 May 25, 2021
Minimal structured logging library for Go

slog slog is a minimal structured logging library for Go. Install go get cdr.dev/slog Features Minimal API First class context.Context support First c

Coder 245 Aug 27, 2022
Fully asynchronous, structured, pluggable logging for Go.

logr Logr is a fully asynchronous, contextual logger for Go. It is very much inspired by Logrus but addresses two issues: Logr is fully asynchronous,

Mattermost 15 Sep 23, 2022
structured logging helper

Logart Logart is a structured logging tool that aims to simplify logging to a database It is not yet in stable state, but is used in production and ac

Karitham 3 Apr 24, 2021
Go-metalog - Standard API for structured logging

Metalog is a standard API for structured logging and adapters for its implementa

Kirill 4 Jan 20, 2022
Leveled execution logs for Go

glog ==== Leveled execution logs for Go. This is an efficient pure Go implementation of leveled logs in the manner of the open source C++ package h

Go 3.2k Sep 25, 2022
CoLog is a prefix-based leveled execution log for Go

What's CoLog? CoLog is a prefix-based leveled execution log for Go. It's heavily inspired by Logrus and aims to offer similar features by parsing the

null 156 Aug 2, 2022
Leveled execution logs for Go.

glog Leveled execution logs for Go. This is an efficient pure Go implementation of leveled logs in the manner of the open source C++ package glog. By

null 0 Nov 29, 2021
Blazing fast syslog parser

A parser for Syslog messages and transports. Blazing fast Syslog parsers By @leodido. To wrap up, this package provides: a RFC5424-compliant parser an

InfluxData 425 Sep 26, 2022
Golog is a logger which support tracing and other custom behaviors out of the box. Blazing fast and simple to use.

GOLOG Golog is an opinionated Go logger with simple APIs and configurable behavior. Why another logger? Golog is designed to address mainly two issues

Damiano Petrungaro 35 Sep 10, 2022