refactor micro && logger interface && upate printlogs
Some checks failed
lint / lint (pull_request) Has been cancelled
pr / test (pull_request) Has been cancelled

This commit is contained in:
2024-10-11 15:54:46 +03:00
parent 0bb2a2f0dc
commit 4a787dd2c3
14 changed files with 86 additions and 480 deletions

View File

@@ -4,6 +4,7 @@ package config
import (
"context"
"errors"
"fmt"
"reflect"
"time"
)
@@ -138,7 +139,7 @@ var (
return nil
}
if err := fn(ctx, c); err != nil {
c.Options().Logger.Errorf(ctx, "%s BeforeLoad err: %v", c.String(), err)
c.Options().Logger.Error(ctx, fmt.Sprintf("%s BeforeLoad err: %v", c.String(), err), err)
if !c.Options().AllowFail {
return err
}
@@ -153,7 +154,7 @@ var (
return nil
}
if err := fn(ctx, c); err != nil {
c.Options().Logger.Errorf(ctx, "%s AfterLoad err: %v", c.String(), err)
c.Options().Logger.Error(ctx, fmt.Sprintf("%s AfterLoad err: %v", c.String(), err), err)
if !c.Options().AllowFail {
return err
}
@@ -168,7 +169,7 @@ var (
return nil
}
if err := fn(ctx, c); err != nil {
c.Options().Logger.Errorf(ctx, "%s BeforeSave err: %v", c.String(), err)
c.Options().Logger.Error(ctx, fmt.Sprintf("%s BeforeSave err: %v", c.String(), err), err)
if !c.Options().AllowFail {
return err
}
@@ -183,7 +184,7 @@ var (
return nil
}
if err := fn(ctx, c); err != nil {
c.Options().Logger.Errorf(ctx, "%s AfterSave err: %v", c.String(), err)
c.Options().Logger.Error(ctx, fmt.Sprintf("%s AfterSave err: %v", c.String(), err), err)
if !c.Options().AllowFail {
return err
}
@@ -198,7 +199,7 @@ var (
return nil
}
if err := fn(ctx, c); err != nil {
c.Options().Logger.Errorf(ctx, "%s BeforeInit err: %v", c.String(), err)
c.Options().Logger.Error(ctx, fmt.Sprintf("%s BeforeInit err: %v", c.String(), err), err)
if !c.Options().AllowFail {
return err
}
@@ -213,7 +214,7 @@ var (
return nil
}
if err := fn(ctx, c); err != nil {
c.Options().Logger.Errorf(ctx, "%s AfterInit err: %v", c.String(), err)
c.Options().Logger.Error(ctx, fmt.Sprintf("%s AfterInit err: %v", c.String(), err), err)
if !c.Options().AllowFail {
return err
}