Add log level

This commit is contained in:
d1slike committed 2024-05-15 13:54:40 +03:00
1 parent 8275c01d21
commit 0320131d57
3 files changed
+11 -2

No files matched your search

+2
View File
@@ -11,6 +11,8 @@ moduleName: isp-config-service
infraServerPort: 9006
logLevel: debug
rqlite:
DataPath: "data"
NodeID: 1
+9 -1
View File
@@ -58,8 +58,16 @@ func New(boot *bootstrap.Bootstrap) *Service {
// nolint:funlen
func (s *Service) Run(ctx context.Context) error {
logLevelValue := s.boot.App.Config().Optional().String("logLevel", "info")
var logLevel log.Level
err := logLevel.UnmarshalText([]byte(logLevelValue))
if err != nil {
return errors.WithMessage(err, "parse log level")
}
s.boot.App.Logger().SetLevel(logLevel)
localConfig := conf.Local{}
err := s.boot.App.Config().Read(&localConfig)
err = s.boot.App.Config().Read(&localConfig)
if err != nil {
return errors.WithMessage(err, "read local config")
}
-1
View File
@@ -27,7 +27,6 @@ func TestAcceptance(t *testing.T) {
t.Setenv("APP_CONFIG_PATH", "../conf/config.yml")
t.Setenv("DefaultRemoteConfigPath", "../conf/default_remote_config.json")
boot := bootstrap.New("1.0.0", conf.Remote{}, nil)
boot.App.Logger().SetLevel(log.DebugLevel)
boot.MigrationsDir = "../migrations"
dataPath := dataDir(t)
boot.App.Config().Set("rqlite.DataPath", dataPath)