sl

package module
v0.0.0-...-a163b3d Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 0 Imported by: 0

README

sl: Structure Logging Interface

A small opinionated log interface for Go for structured logging. Only supports 2 types of logs:

  • Info: For informational logging.
  • Error: For error logging.
API

The sl.Log interface exposes the following methods:

  • With(metadata interface{}) GGLog: Provide a new logger that will include the metadata in subsequent logs.
  • Info(message string): Log the provided message at the info level.
  • Infof(format string, v ...interface{}): Format and log the provided message at the info level.
  • Infow(metadata interface{}, message string): A shortened version of With(metadata).Info(message).
  • Infofw(metadata interface{}, format string, v ...interface{}): A shortened version of With(metadata).Infof(message, v...).
  • Error(message string): Log the provided message at the error level.
  • Errorf(format string, v ...interface{}): Format and log the provided message at the error level.
  • Errorw(metadata interface{}, message string): A shortened version of With(metadata).Error(message).
  • Errorfw(metadata interface{}, format string, v ...interface{}): A shortened version of With(metadata).Errorf(message, v...).
  • V(verbosity int) bool: Determine if the provided verbosity is supported.

Implementations

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log interface {
	With(metadata interface{}) Log
	Info(message string)
	Infof(format string, v ...interface{})
	Infow(metadata interface{}, message string)
	Infofw(metadata interface{}, format string, v ...interface{})
	Error(message string)
	Errorf(format string, v ...interface{})
	Errorw(metadata interface{}, message string)
	Errorfw(metadata interface{}, format string, v ...interface{})
	V(verbosity int) bool
}

Log is an interface for logging.

Jump to

Keyboard shortcuts

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