Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

logging

v0.0.0-20181205230544-06b3318d99b5
github.com/adzr/logging

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

9 matches

Top ↑

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

Constants

DefaultFormat (2 declarations)

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

Functions

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

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.

Configuration

func Configuration() *Config

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

Dependency graph