From 8d2b9d6be77dd433fefba752d0852464f7cf262e Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Fri, 13 Mar 2020 20:53:31 -0700 Subject: [PATCH] Add comments to exported types and functions from internal/log package --- internal/log/log.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/log/log.go b/internal/log/log.go index 56c1db9..ba3b368 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -11,36 +11,45 @@ import ( "os" ) +// NewLogger creates and returns a new instance of Logger. func NewLogger(out io.Writer) *Logger { return &Logger{ stdlog.New(out, "", stdlog.Ldate|stdlog.Ltime|stdlog.Lmicroseconds|stdlog.LUTC), } } +// Logger is a wrapper object around log.Logger from the standard library. +// It supports logging at various log levels. type Logger struct { *stdlog.Logger } +// Debug logs a message at Debug level. func (l *Logger) Debug(format string, args ...interface{}) { format = "DEBUG: " + format l.Printf(format, args...) } +// Info logs a message at Info level. func (l *Logger) Info(format string, args ...interface{}) { format = "INFO: " + format l.Printf(format, args...) } +// Warn logs a message at Warning level. func (l *Logger) Warn(format string, args ...interface{}) { format = "WARN: " + format l.Printf(format, args...) } +// Error logs a message at Error level. func (l *Logger) Error(format string, args ...interface{}) { format = "ERROR: " + format l.Printf(format, args...) } +// Fatal logs a message at Fatal level +// and process will exit with status set to 1. func (l *Logger) Fatal(format string, args ...interface{}) { format = "FATAL: " + format l.Printf(format, args...)