alog

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MIT Imports: 12 Imported by: 0

README

ALog - Fast and asynchronous logger

ALog GitHub tag codecov Scrutinizer Code Quality Codacy Badge Maintainability Go Report Card codebeat badge License GoDoc Sourcegraph HitCount

Install

go get -u github.com/mylockerteam/alog

Configure

Documentation

Index

Constants

View Source
const (
	LoggerInfo uint = iota
	LoggerWrn
	LoggerErr
)
View Source
const (
	ErrCanNotCreateDirectory = "can't create directory"
)

Variables

This section is empty.

Functions

func GetDefaultStrategy

func GetDefaultStrategy() io.Writer

GetDefaultStrategy console write strategy

func GetEnv

func GetEnv(key string) []byte

GetEnv returns ENV variable from environment or .env file as []byte

func GetEnvStr

func GetEnvStr(key string) string

GetEnvStr returns ENV variable from environment or .env file as string

func GetFileStrategy

func GetFileStrategy(filePath string) io.Writer

GetFileStrategy file write strategy

func LoggerName

func LoggerName(code uint) string

LoggerName returns a name for the logger. It returns the empty string if the code is unknown.

Types

type Config

type Config struct {
	TimeFormat string
	Loggers    LoggerMap
}

type DefaultStrategy

type DefaultStrategy struct {
}

func (*DefaultStrategy) Write

func (s *DefaultStrategy) Write(p []byte) (n int, err error)

type FileStrategy

type FileStrategy struct {
	// contains filtered or unexported fields
}

func (*FileStrategy) Write

func (s *FileStrategy) Write(p []byte) (n int, err error)

type Log

type Log struct {
	// contains filtered or unexported fields
}

func Create

func Create(config *Config) *Log

Create creates an instance of the logger

func (*Log) Error

func (a *Log) Error(err error) *Log

Method for recording errors without stack

func (*Log) ErrorDebug

func (a *Log) ErrorDebug(err error) *Log

ErrorDebug method for recording errors with stack

func (*Log) Info

func (a *Log) Info(msg string) *Log

Info method for recording informational messages

func (*Log) Infof

func (a *Log) Infof(format string, p ...interface{}) *Log

Infof method of recording formatted informational messages

func (*Log) Warning

func (a *Log) Warning(msg string) *Log

Warning method for recording warning messages

type Logger

type Logger struct {
	Channel    chan string
	Strategies []io.Writer
}

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

Writer interface for informational messages

type LoggerMap

type LoggerMap map[uint]*Logger

Jump to

Keyboard shortcuts

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