pjvds / tidy

Go lang structured logging made fast and simple
7 stars 0 forks source link

tidy

Build Status

Flexible structured logging for Go that is not fast by accident.

// simple fluent configuration API
tidy.Configure()
  .LogFromLevel(tidy.DEBUG).To(tidy.Console)
  .LogFromLevel(tidy.INFO).To(logentries.Token(token))
  .BuildDefault()

// get a logger for the current context
log := tidy.GetLogger()

// log an entry with a single field at debug level
log.With("user", session.User).Debug("user authenticated")

// log entry with multiple fields at warning level
log.Withs(tidy.Fields{
  "user": session.User,
  "url": request.Url,
).Warn("unauthorized request")

Output example

08:45:10 W (my_module): user authenticated     → username=catty
08:45:11 W (my_module): unauthorized request   → username=catty url=/list/5

Git Commit Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

Any line of the commit message cannot be longer 100 characters! This allows the message to be easier to read on github as well as in various git tools.

Type

Must be one of the following:

Scope

The scope could be anything specifying place of the commit change. For example logger, text, console, appengine, backend, etc...

Subject

The subject contains succinct description of the change:

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes" The body should include the motivation for the change and contrast this with previous behavior.

Footer

The footer might reference GitHub issues that this commit relates to or Closes.