Skip to content

Commit 41822b3

Browse files
committed
feat: microfix env
1 parent ff681f4 commit 41822b3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

logger.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import (
1313
"github.com/labstack/gommon/log"
1414
)
1515

16-
var (
17-
env = os.Getenv("ENV")
18-
)
19-
2016
// ContextHandler is our base context handler, it will handle all requests
2117
type ContextHandler struct {
2218
slog.Handler
@@ -144,7 +140,7 @@ func Replacer(groups []string, a slog.Attr) slog.Attr {
144140
}
145141

146142
func Errorf(ctx context.Context, format string, args ...interface{}) {
147-
if env == "dev" {
143+
if os.Getenv("ENV") == "dev" {
148144
log.Errorf(format, args...)
149145
return
150146
}
@@ -153,7 +149,7 @@ func Errorf(ctx context.Context, format string, args ...interface{}) {
153149
}
154150

155151
func Infof(ctx context.Context, format string, args ...interface{}) {
156-
if env == "dev" {
152+
if os.Getenv("ENV") == "dev" {
157153
log.Infof(format, args...)
158154
return
159155
}
@@ -162,7 +158,7 @@ func Infof(ctx context.Context, format string, args ...interface{}) {
162158
}
163159

164160
func Warnf(ctx context.Context, format string, args ...interface{}) {
165-
if env == "dev" {
161+
if os.Getenv("ENV") == "dev" {
166162
log.Warnf(format, args...)
167163
return
168164
}
@@ -171,7 +167,7 @@ func Warnf(ctx context.Context, format string, args ...interface{}) {
171167
}
172168

173169
func Debugf(ctx context.Context, format string, args ...interface{}) {
174-
if env == "dev" {
170+
if os.Getenv("ENV") == "dev" {
175171
log.Debugf(format, args...)
176172
return
177173
}

0 commit comments

Comments
 (0)