logrusen

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

logrusen

Wrapper for logrus package

Usage

import "github.com/teamseodo/logrusen"

func main() {
	logger := logrusen.New()
	err := logger.Setup()

	if err != nil {
		logger.Error("Logger initialization error", err, nil)
	}
	logger.Info("Info testing", nil)
	logger.Debug("Debug testing", logrusen.Fields{"test": "testvalue"})
	logger.Warn("Warn logging", err, nil)
	logger.Fatal("Fatal logging", err, nil)
}

Tests

$ go test -v *.go
=== RUN   TestNew
=== RUN   TestNew/create_standard_logger
--- PASS: TestNew (0.00s)
    --- PASS: TestNew/create_standard_logger (0.00s)
=== RUN   Test_standardLogger_Setup
=== RUN   Test_standardLogger_Setup/invalid_env_name_(env:development)
=== RUN   Test_standardLogger_Setup/valid_env_name_(env:dev)
=== RUN   Test_standardLogger_Setup/valid_env_name_but_dsn_is_invalid_(env:prod,_dsn:123456789)
=== RUN   Test_standardLogger_Setup/invalid_env_name_(env:test)
--- PASS: Test_standardLogger_Setup (0.01s)
    --- PASS: Test_standardLogger_Setup/invalid_env_name_(env:development) (0.00s)
    --- PASS: Test_standardLogger_Setup/valid_env_name_(env:dev) (0.00s)
    --- PASS: Test_standardLogger_Setup/valid_env_name_but_dsn_is_invalid_(env:prod,_dsn:123456789) (0.01s)
    --- PASS: Test_standardLogger_Setup/invalid_env_name_(env:test) (0.00s)
=== RUN   Test_stdFields
=== RUN   Test_stdFields/foo_and_topic1
=== RUN   Test_stdFields/fib_and_topic2
--- PASS: Test_stdFields (0.00s)
    --- PASS: Test_stdFields/foo_and_topic1 (0.00s)
    --- PASS: Test_stdFields/fib_and_topic2 (0.00s)
PASS
ok  	command-line-arguments	0.544s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields log.Fields

type StandardLogger

type StandardLogger interface {
	Debug(message string, fields Fields)
	Info(message string, fields Fields)
	Warn(message string, err error, fields Fields)
	Error(message string, err error, fields Fields)
	Fatal(message string, err error, fields Fields)
	Panic(message string, err error, fields Fields)

	Setup() error
	SetupWithSentry(dsn string) error
}

func New

func New() StandardLogger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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