-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from bmf-san/feature/replace-logger-to-slog
[update] replace logger
- Loading branch information
Showing
17 changed files
with
66 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.20.0-alpine as builder | ||
FROM golang:1.21.0-alpine as builder | ||
|
||
WORKDIR /go/gobel-api/app | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.20.0-alpine | ||
FROM golang:1.21.0-alpine | ||
|
||
WORKDIR /go/gobel-api/app | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,16 @@ | ||
package infrastructure | ||
|
||
import ( | ||
"time" | ||
"os" | ||
|
||
"github.com/bmf-san/golem" | ||
"log/slog" | ||
) | ||
|
||
// A Logger represents a logger. | ||
type Logger struct { | ||
logger *golem.Logger | ||
} | ||
|
||
// NewLogger creates a Logger. | ||
func NewLogger(threshold int, location *time.Location) *Logger { | ||
return &Logger{ | ||
logger: golem.NewLogger(threshold, location), | ||
} | ||
} | ||
|
||
// Fatal outputs a fatal level log. | ||
func (l *Logger) Fatal(msg string) { | ||
l.logger.Fatal(msg) | ||
} | ||
|
||
// Error outputs a fatal level log. | ||
func (l *Logger) Error(msg string) { | ||
l.logger.Error(msg) | ||
} | ||
|
||
// Warn outputs a fatal level log. | ||
func (l *Logger) Warn(msg string) { | ||
l.logger.Warn(msg) | ||
} | ||
|
||
// Info outputs a fatal level log. | ||
func (l *Logger) Info(msg string) { | ||
l.logger.Info(msg) | ||
// NewLogger creates a logger. | ||
func NewLogger(level int) *slog.Logger { | ||
handler := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{ | ||
Level: slog.Level(level), | ||
}) | ||
logger := slog.New(handler) | ||
return logger | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters