Skip to content

Releases: go-playground/log

Release 2.0

24 May 14:09
Compare
Choose a tag to compare

Version 2.0 Released!

Whats New?

  • Refined existing handlers, now a little more efficient and faster
  • Removed a few methods from the handlers that are not strictly necessary and cluttering things up.
  • Added ability to set the individual log levels to gather file + line number information for using the function SetCallerInfoLevels(...), the default is all except TraceLevel, InfoLevel and NoticeLevel.
  • Add ability per handler to specify if want full file path, minus gopath, for short file ( just filename ) when file + line number data is present.
  • Added function SetCallerSkipDiff(...), this is for other libraries that may want to wrap this library, but then need to increase the caller skip level to accurately report the file + line number information.
  • Updating default time format to include nanoseconds DefaultTimeFormat = "2006-01-02T15:04:05.000000000Z07:00"
  • Added HasHandlers() function which returns if there are any handlers registered with the library; useful when a library would like to log but the main application may not has specified any handlers or the main application is not using this library to log, and can register it's own default logger.
  • Updated handlers to allow for better overriding of default formatter if desired.
  • Add ability to set not only the log buffer, but also number of workers you want to spin up and listen on that buffer within the bultin handlers.
  • Add http handler for use with many different endpoints, such as Elasticsearch, JSON, ... thanks to @hartfordfive

Breaking changes

for most, there will be none but had to bump the version for anyone that may have been using some of the functions that were removed, replaced or updated; here is a list of the functions:

  • SetCallerInfo(..) --- now ---> SetCallerInfoLevels(...)
For Handlers
  • UseMiniTimestamp - Removed
  • SetColorLevel(..) --> Removed
  • SetBuffer(...) --- now ---> SetBuffersAndWorkers(...)
  • may have missed some...

Release 1.4

01 May 15:23
Compare
Choose a tag to compare

What Changed

  • Started making release notes 😉
  • Added ability to report file + line number if desired (NOTE: there is overhead to this, so default=off)
  • Output format of the default handlers were altered slightly.
  • Handlers now call e.Consumed() instead of w.WG.Done(); this is to hide the inner implementation and make it more flexible for future changes behind the scenes without breaking changes.

How to turn on file+line number?

// NOTE: this must be set prior to registering any handlers
// as the handlers may call log.GetCallerInfo() to determine 
// their output while being registered
log.SetCallerInfo(true)

Where if the file+line number information

Right on the Entry Object

e.File
e.Line