logging - Limitations of GO lang log package -
i implementing logger in go. thinking of using logrus this. wanted understand limitations of built in log package.
i know if want write logs file or implement rolling file logs etc need add feature manually. there other limitations have choose external log package?
logging file using builtin log
package not issue, can use log.setoutput()
or logger.setoutput()
set destination io.writer
other default os.stderr
, example file *os.file
.
what's missing , whished leveled logging (e.g. info
, warn
, debug
, error
etc.). reasoning, read blog post dave cheney: let's talk logging.
you can't enforce specific log.logger
used designated packages unless packages "willing" cooperate (e.g. provide setlogger()
function).
rolling log files missing feature.
on other hand, it's easy "extend" standard logger log mongodb example, details see go: create io.writer inteface logging mongodb database. using mongodb can use capped collection implicitly give "rolling file" functionality.
Comments
Post a Comment