golog

package module
v0.0.0-...-462b0b3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2017 License: Unlicense Imports: 9 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

Golog

Initialize a logger, based on logrus, with builtin possibilities of:

  • File logger
    • With rotation support
  • MongoDB logging

Install

go get github.com/normegil/golog

Usage

See Godoc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) (*logrus.Entry, error)

New create a new logrus logger & configure it based on Options

Types

type FileOptions

type FileOptions struct {
	//FolderPath is the path to the folder where the log files will be stored
	FolderPath string
	//FileName is the filename prefix that will be used to create the log file. Suffix will be added to differentiate between log file types.
	FileName string
	//MaxAge is the dureation between rotations of the log files
	MaxAge time.Duration
}

FileOptions controls the options that revolve around file logging. If it's not specified, file won't be created

type MongoOptions

type MongoOptions struct {
	URL      string
	Database string
	User     string
	Password string
}

MongoOptions controls the options that revolve around file logging. If it's not specified, file won't be created

type Options

type Options struct {
	// Verbose controls the verbosity of the log (Set to true if you want a DebugLevel logger)
	Verbose bool
	File    FileOptions
	DB      MongoOptions
}

type SimpleLogger

type SimpleLogger interface {
	Print(string)
}

type StructuredLogger

type StructuredLogger interface {
	SimpleLogger
	WithField(key string, object interface{}) StructuredLogger
}

type VoidLogger

type VoidLogger struct{}

func (VoidLogger) Print

func (v VoidLogger) Print(string)

func (VoidLogger) WithField

func (v VoidLogger) WithField(key string, object interface{}) StructuredLogger

Jump to

Keyboard shortcuts

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