go-sync-logger

module
v0.0.0-...-898cb84 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2019 License: MIT

README

CircleCI Go Report Card GoDoc license

go-sync-logger

Description

go-sync-logger (aka GSL) is a simple concurrency-safe library for sharing writers (e.g., stdout, errors.log, etc.) among multiple log levels. With GSL you can have info and error messages share a log with messages being written in the proper sequence.

go-sync-logger depends on:

Usage

Go

You can import go-sync-logger as a library with:

import (
  "github.com/spatialcurrent/go-sync-logger/gsl"
)

To initialize the logger, use gsl.NewLogger and pass it the writers, formats, and proper mapping of levels to writers. For example, the configuration below, has error and warn share a writer.

... () {
  logger := gsl.NewLogger(
    map[string]int{"info": 0, "error": 1, "warn": 1},
    []grw.ByteWriteCloser{infoWriter, errorWriter},
    []string{infoFormat, errorFormat},
  )
}

For a complete example on how to initialize the logger using configuration provided by viper see viper.md in examples.

See gsl in GoDoc for information on how to use Go API.

Contributing

Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see Contributing.md for how to get started.

License

This work is distributed under the MIT License. See LICENSE file.

Directories

Path Synopsis
pkg
gsl
Package gsl provides a concurrency-safe logger.
Package gsl provides a concurrency-safe logger.

Jump to

Keyboard shortcuts

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