Added error to return values in some functions
This commit is contained in:
@@ -12,7 +12,7 @@ type Logger struct {
|
||||
appName string
|
||||
}
|
||||
|
||||
func NewLogger(appName, fHost string, fPort int) *Logger {
|
||||
func NewLogger(appName, fHost string, fPort int) (*Logger, error) {
|
||||
config := fluent.Config{
|
||||
FluentHost: fHost,
|
||||
FluentPort: fPort,
|
||||
@@ -20,10 +20,10 @@ func NewLogger(appName, fHost string, fPort int) *Logger {
|
||||
}
|
||||
fluent, err := fluent.New(config)
|
||||
if err != nil {
|
||||
log.Panicf("Error connecting to %s: %v", fHost, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Logger{fluent, appName}
|
||||
return &Logger{fluent, appName}, nil
|
||||
}
|
||||
|
||||
func (l *Logger) Log(format string, v ...any) {
|
||||
|
||||
Reference in New Issue
Block a user