logging

package module
v0.0.0-...-06b3318 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

logging

This library provides custom gokit logger implementation(s).

License GoDoc TravisCI Codecov Go Report Card

Documentation

Please refer to the godoc pages for documentation.

Versioning

This project release version format follows Semantic Versioning.

Contributing

Pull requests and issue reports are welcomed.

License

This project is licensed under Apache License Version 2.0

Documentation

Overview

Package logging provides custom gokit logger implementation(s).

Brief

This library provides custom gokit logger implementation(s), currently it provides JSON formatted stdout & stderr sync. implementation.

Usage

$ go get -u github.com/adzr/logging

Then, import the package:

import (
  "github.com/adzr/logging"
)

Example

logger := logging.CreateStdSyncLogger("mylogger", logging.DefaultLoggingConfiguration())
logger.Log("key", "value")

Index

Constants

View Source
const (
	// DefaultFormat is the default logging output format.
	DefaultFormat = "json"
	// DefaultLevel is the default logging severity level.
	DefaultLevel = "info"
)

Variables

This section is empty.

Functions

func CreateStdSyncLogger

func CreateStdSyncLogger(loggerName string, counter metrics.Counter, config *Config) log.Logger

CreateStdSyncLogger returns an instance of stdout & stderr instrumented logger. If configuration level is set to 'none' then neither logs nor monitoring will take place.

Types

type Config

type Config struct {
	// Format is the logging output format, it can be only 'json' for now, any other value will be ignored.
	Format string `json:"format"`
	// Level is the logging severity level allowed, it can be 'none', 'error', 'warn', 'info', 'debug'.
	// If set to 'none' no logs will appear.
	Level string `json:"level"`
}

Config carries service logging configuration.

func Configuration

func Configuration() *Config

Configuration returns a new instance of the default configurations for logging.

Jump to

Keyboard shortcuts

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