log

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: MIT Imports: 2 Imported by: 1

README

go.nownabe.dev/log

GoDoc License Go Report Card GolangCI

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger *zap.SugaredLogger

	// Debugw logs a message with some additional context.
	// The variadic key-value pairs are treated as they are in With.
	Debugw wfunc

	// Infow logs a message with some additional context.
	// The variadic key-value pairs are treated as they are in With.
	Infow wfunc

	// Warnw logs a message with some additional context.
	// The variadic key-value pairs are treated as they are in With.
	Warnw wfunc

	// Errorw logs a message with some additional context.
	// The variadic key-value pairs are treated as they are in With.
	Errorw wfunc

	// Panicw logs a message with some additional context,
	// then panics. The variadic key-value pairs are treated as they are in With.
	Panicw wfunc

	// Sync flushes any buffered log entries.
	Sync func() error
)

Functions

func Init

func Init(development bool)

Init initializes logger. If development is true, it builds development logger that writes Debug and above logs to stderr in a human-friendly format.

func Logw

func Logw(l Level, msg string, keysAndValues ...interface{})

Logw logs a message as specified log level.

Types

type Level

type Level int

Level is a logging priority. Higher levels are more important.

const (
	// LevelDebug logs are typically voluminous,
	// and are usually disabled in production.
	LevelDebug Level = 1
	// LevelInfo is the default logging priority.
	LevelInfo Level = 2
	// LevelWarn logs are more important than Info,
	// but donn't need individual human review.
	LevelWarn Level = 3
	// LevelError logs are high-priority.
	// If an application is running smoothly,
	// Error logs shouldn't appear.
	LevelError Level = 4
)

func (Level) String

func (l Level) String() string

String returns a human friendly text of the log level.

Jump to

Keyboard shortcuts

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