From 2dc64b70e177f706ca3bc54a36ea32f89ff86a34 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 30 Mar 2018 12:00:46 +0200 Subject: [PATCH] godoc for logger package + typo in godoc of main package + typo in gotenberg.yml --- app/logger/logger.go | 18 ++++++++++++++++-- gotenberg.yml | 2 +- main.go | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/logger/logger.go b/app/logger/logger.go index fbf04db8..37a55e41 100644 --- a/app/logger/logger.go +++ b/app/logger/logger.go @@ -1,4 +1,4 @@ -// Package logger +// Package logger implements a simple wrapper of the logrus library. package logger import ( @@ -7,12 +7,15 @@ import ( "github.com/sirupsen/logrus" ) +// logger wraps a logrus.Logger instance. type logger struct { logger *logrus.Logger } -var log *logger = newLogger() +// log is our logger instance used accross the application. +var log = newLogger() +// newLogger instantiates a logger instance with default values. func newLogger() *logger { l := &logger{ logger: logrus.New(), @@ -24,42 +27,53 @@ func newLogger() *logger { return l } +// SetLevel updates the level of messages which will be logged. func SetLevel(level logrus.Level) { log.logger.SetLevel(level) } +// SetFormatter updates the output format. +// When a TTY is not attached, the output will be in the defined format. func SetFormatter(formatter logrus.Formatter) { log.logger.Formatter = formatter } +// Debug is a wrapper of the logrus Debug function. func Debug(message string) { log.logger.Debug(message) } +// Debugf is a wrapper of the logrus Debugf function. func Debugf(format string, args ...interface{}) { log.logger.Debugf(format, args) } +// Info is a wrapper of the logrus Info function. func Info(message string) { log.logger.Info(message) } +// Infof is a wrapper of the logrus Infof function. func Infof(format string, args ...interface{}) { log.logger.Infof(format, args) } +// Warn is a wrapper of the logrus Warn function. func Warn(message string) { log.logger.Warn(message) } +// Error is a wrapper of the logrus Error function. func Error(err error) { log.logger.Error(err.Error()) } +// Fatal is a wrapper of the logrus Fatal function. func Fatal(err error) { log.logger.Fatal(err.Error()) } +// Panic is a wrapper of the logrus Panic function. func Panic(err error) { log.logger.Panic(err.Error()) } diff --git a/gotenberg.yml b/gotenberg.yml index 084ca535..3e48d72d 100644 --- a/gotenberg.yml +++ b/gotenberg.yml @@ -7,7 +7,7 @@ logs: level: "DEBUG" # Accepted values: text, json. - # When a TTY is not attached, the output will be in the definied format. + # When a TTY is not attached, the output will be in the defined format. format: "text" commands: diff --git a/main.go b/main.go index 71718f03..35a8d1e3 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ /* Package main handles the application startup and shutdown. -Gotenberg is a stateless API for converting HTML files and Office document to PDF. +Gotenberg is a stateless API for converting HTML files and Office documents to PDF. For more information, go to https://github.com/gulien/gotenberg. */