[ANN] stdlog: leveled execution logs, useful for cron jobs

148 views
Skip to first unread message

Alexandre Cesaro

unread,
Jul 1, 2014, 6:01:55 AM7/1/14
to golan...@googlegroups.com
Hello, here is a mail about a previous package I made: stdlog

It provides leveled execution logs and has features that go nicely with cron jobs. The options are passed with command-line flags.
For example, a program launched with parameters "-debug -flushlog=error" by a crontab where the variable MAILTO is set will send all logs generated by the program (even debug logs) only if an error happens. When no error happens, no email is sent.
Example of use:
logger := stdlog.GetFromFlags()
logger.Info("Connecting to the server...")
logger.Errorf("Connection failed: %q", err)

Will output:

2014-04-02 18:09:15.862 INFO Connecting to the API...
2014-04-02 18:10:14.347 ERROR Connection failed (Server is unavailable).

Siddon Tang

unread,
Jul 4, 2014, 3:33:34 AM7/4/14
to golan...@googlegroups.com
Good job! 

I have implemented a similar one here: https://github.com/siddontang/go-log, not only leveled support, you can use multi handlers same like python logging handlers.

Maybe I can support command-line flags too, thank you! 

在 2014年7月1日星期二UTC+8下午6时01分55秒,Alexandre Cesaro写道:
Reply all
Reply to author
Forward
0 new messages