Documentation
¶
Overview ¶
Package log provides basic logging mechanism.
You can log into physical file, but log rotation is not implemented, see https://12factor.net/logs => Ideally write to /dev/stderr|stdout|null and use something like https://github.com/logrotate/logrotate or https://github.com/agnivade/funnel for log post processing (funnel supports multiple targets, storing into files with rotation and compression) so let's not reinvent the wheel here.. TODO: - Enrich logger with methods of std logger for use in third party libs that needs it - If you get really bored some day: -- implement rolling files with https://github.com/natefinch/lumberjack -- allow writing into multiple files with io.MultiWriter
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenFileHelper ¶
OpenFileHelper tries to make or create file (including dirs) with proper flags for use in logger
func StaticHook ¶
StaticHook returns hook for logging static name, value pair to every probe (like hostname, PID, local IP and such..), basic types are cast to avoid reflection
func TimestampHook ¶
TimestampHook returns hook for logging UnixNano timestamp as float64
Types ¶
type Logger ¶
Logger represents wrapper for logging mechanism
func New ¶
New creates logger if opening log file fails, logger will fallback to stderr you might want to use a log router like https://github.com/agnivade/funnel to handle app log output