mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 12:22:17 +01:00
godoc for logger package + typo in godoc of main package + typo in gotenberg.yml
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// Package logger
|
// Package logger implements a simple wrapper of the logrus library.
|
||||||
package logger
|
package logger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -7,12 +7,15 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// logger wraps a logrus.Logger instance.
|
||||||
type logger struct {
|
type logger struct {
|
||||||
logger *logrus.Logger
|
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 {
|
func newLogger() *logger {
|
||||||
l := &logger{
|
l := &logger{
|
||||||
logger: logrus.New(),
|
logger: logrus.New(),
|
||||||
@@ -24,42 +27,53 @@ func newLogger() *logger {
|
|||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLevel updates the level of messages which will be logged.
|
||||||
func SetLevel(level logrus.Level) {
|
func SetLevel(level logrus.Level) {
|
||||||
log.logger.SetLevel(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) {
|
func SetFormatter(formatter logrus.Formatter) {
|
||||||
log.logger.Formatter = formatter
|
log.logger.Formatter = formatter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug is a wrapper of the logrus Debug function.
|
||||||
func Debug(message string) {
|
func Debug(message string) {
|
||||||
log.logger.Debug(message)
|
log.logger.Debug(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debugf is a wrapper of the logrus Debugf function.
|
||||||
func Debugf(format string, args ...interface{}) {
|
func Debugf(format string, args ...interface{}) {
|
||||||
log.logger.Debugf(format, args)
|
log.logger.Debugf(format, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Info is a wrapper of the logrus Info function.
|
||||||
func Info(message string) {
|
func Info(message string) {
|
||||||
log.logger.Info(message)
|
log.logger.Info(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Infof is a wrapper of the logrus Infof function.
|
||||||
func Infof(format string, args ...interface{}) {
|
func Infof(format string, args ...interface{}) {
|
||||||
log.logger.Infof(format, args)
|
log.logger.Infof(format, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warn is a wrapper of the logrus Warn function.
|
||||||
func Warn(message string) {
|
func Warn(message string) {
|
||||||
log.logger.Warn(message)
|
log.logger.Warn(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error is a wrapper of the logrus Error function.
|
||||||
func Error(err error) {
|
func Error(err error) {
|
||||||
log.logger.Error(err.Error())
|
log.logger.Error(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fatal is a wrapper of the logrus Fatal function.
|
||||||
func Fatal(err error) {
|
func Fatal(err error) {
|
||||||
log.logger.Fatal(err.Error())
|
log.logger.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Panic is a wrapper of the logrus Panic function.
|
||||||
func Panic(err error) {
|
func Panic(err error) {
|
||||||
log.logger.Panic(err.Error())
|
log.logger.Panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ logs:
|
|||||||
level: "DEBUG"
|
level: "DEBUG"
|
||||||
|
|
||||||
# Accepted values: text, json.
|
# 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"
|
format: "text"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Package main handles the application startup and shutdown.
|
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.
|
For more information, go to https://github.com/gulien/gotenberg.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user