Skip to content

Better logging.

Compare
Choose a tag to compare
@jortel jortel released this 16 Apr 14:44
· 74 commits to master since this release
10318be

Add logger to many objects.
Strategic add of logging statements.
Add context to wrapped/returned error.

The log level approach:

  • Level=0-2 not used by the lib. reserved for applications.
  • Level=3 for: basic info logging for high level things created/deleted opened/closed.
  • Level=4 for: basic debug. has a lot of detail but relatively low numbers
  • Level=5 for: low level debug. high volume changes like watch events and filebacked read/write.

Added an id to both model.Watch and both model.Event and web.Event for better tracability.

Fixed a bug in the ref package for references watches. The handler needed to filter for by reference owner type.
Fixed a bug .fb files leaked when an iterator is closed but never read. Also added a finalizer so GC iterators will be closed and hard-link deleted. Use case for this would be: iter is written to a channel but the watch is terminated before the channel is drained.

Few changes to the logging.Logger. Mainly:

  • changed to pointer receiver.
  • removed Logger.Reset(). More appropriate for the controller to just use .WithName() to reset the name as needed.
  • Added a package Factory that creates a zap logger by default. Has support for environment variables for both developement mode and logging level.
  • Add true support for verbosity levels. 0-4 = Info, 4+ = debug.