Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a logging package. #43

Merged
merged 3 commits into from
Jan 29, 2019
Merged

Add a logging package. #43

merged 3 commits into from
Jan 29, 2019

Conversation

jwgcarlson
Copy link
Collaborator

This is an attempt to generalize and improve upon the trace() mechanism currently used in the ice package. It defines a leveled logging API, wherein each log statement is assigned a level (corresponding to importance or verbosity). Tags can be used to decide, at runtime, which log statements in each package actually get printed.

I haven't profiled, so I don't know how performant this implementation is, but I believe it's decent. Log statements that are too verbose for the chosen log level are discarded at the earliest possible moment.

Log statements are printed to stderr by default. They are colored according to a scheme that seemed reasonable to me, but there's currently no way to disable or modify the colored output. These are areas for improvement in the future.

Copy link
Member

@thinkski thinkski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ❤️ this

internal/logging/README.md Show resolved Hide resolved
internal/logging/level.go Outdated Show resolved Hide resolved
internal/logging/level.go Outdated Show resolved Hide resolved
internal/logging/colors.go Show resolved Hide resolved
See README.md for a detailed explanation. It's intended to replace the
Go standard library's `log` package, which is IMHO very lacking compared
to standard logging solutions in other languages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants