Skip to content

Commit 14f8d52

Browse files
committed
chore: Add comments. Fix typos.
1 parent 431b9f8 commit 14f8d52

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/config/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package config
22

33
import "go.uber.org/zap/zapcore"
44

5+
//Environment defines the application environment to adjust settings to it.
56
type Environment string
67

78
const (
89
Dev Environment = "dev"
910
Prod Environment = "prod"
1011
)
1112

13+
//LoggerLevel defines the minimum logging level to process
1214
type LoggerLevel string
1315

1416
const (

internal/logger/zap.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"go.uber.org/zap"
66
)
77

8+
//ZapLogger represents zap implementation of the Logger interface
89
type ZapLogger struct {
910
log *zap.SugaredLogger
1011
level config.LoggerLevel
@@ -62,6 +63,7 @@ func (l *ZapLogger) Tracef(format string, args ...interface{}) {
6263
}
6364
}
6465

66+
//createZapSugaredLogger creates sugared logger from the application configuration
6567
func createZapSugaredLogger(conf *config.ApplicationConfig) (*zap.SugaredLogger, error) {
6668
var zConf zap.Config
6769
switch conf.Env {
@@ -83,6 +85,7 @@ func createZapSugaredLogger(conf *config.ApplicationConfig) (*zap.SugaredLogger,
8385
return logger.Sugar(), nil
8486
}
8587

88+
//newZapLogger creates new ZapLogger instance using application configuration
8689
func newZapLogger(conf *config.ApplicationConfig) (*ZapLogger, error) {
8790
logger, err := createZapSugaredLogger(conf)
8891
if err != nil {

0 commit comments

Comments
 (0)