Make short work of your logs!
This repository has been archived on 2021-06-21. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
Go to file
John Olheiser 5e1722bd43 Update colors (#2)
Simplify example

Update colors

Add wrapping

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/jolheiser/beaver/pulls/2
2020-02-26 20:01:20 +00:00
_examples Update import (#1) 2020-02-20 17:25:24 +00:00
color Update colors (#2) 2020-02-26 20:01:20 +00:00
.gitignore Initial commit 2020-01-29 20:38:15 -06:00
.golangci.yml Initial commit 2020-01-29 20:38:15 -06:00
Makefile Update import (#1) 2020-02-20 17:25:24 +00:00
README.md Update colors (#2) 2020-02-26 20:01:20 +00:00
console.go Initial commit 2020-01-29 20:38:15 -06:00
console_test.go Initial commit 2020-01-29 20:38:15 -06:00
console_windows.go Initial commit 2020-01-29 20:38:15 -06:00
go.mod Update import (#1) 2020-02-20 17:25:24 +00:00
go.sum Initial commit 2020-01-29 20:38:15 -06:00
level.go Update import (#1) 2020-02-20 17:25:24 +00:00
level_test.go Initial commit 2020-01-29 20:38:15 -06:00
logger.go Update colors (#2) 2020-02-26 20:01:20 +00:00
logger_test.go Initial commit 2020-01-29 20:38:15 -06:00

README.md

beaver

Make short work of your logs

Loggers

Beaver comes ready to log to stdout via shorthand beaver.Info etc. usage.
However, Beaver can also create new standalone loggers with beaver.New.
Beaver loggers can write to anything implementing the io.Writer interface.

Options

Option Type Effect
TimePrefix boolean Prepends the date/time
StackPrefix boolean Prepends the calling file/line
StackLimit integer Amount of calling file to show, defaults to entire path
LevelPrefix boolean Prepends a logging level prefix, e.g. [T] for Trace
LevelColor boolean Colors the LevelPrefix if enabled
MessageColor boolean Colors the message itself

The default Console configuration is below
Colored messages convey the logging level while reducing the amount of space used for CLI applications

Option Value
TimePrefix false
StackPrefix false
StackLimit 0
LevelPrefix false
LevelColor false
MessageColor true

Colors

Beaver allows you to customize the colors of various parts of the message

color. Default Format
Trace Bold, FgCyan
Debug Bold, FgBlue
Info Bold, FgGreen
Warn Bold, FgYellow
Error Bold, FgRed
Fatal Bold, BgRed
Default None
Time Default
Stack Default
// Set Trace logging to Magenta instead of Bold-Cyan
color.Trace = color.New(color.FgMagenta)

More info for the color package