Skip to content
Snippets Groups Projects
Commit cb2f77c0 authored by Semyon Krestyaninov's avatar Semyon Krestyaninov
Browse files

refactor

parent b2b4f7a2
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,8 @@ import (
"sync"
"time"
"git.perx.ru/perxis/perxis-go/log"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/log"
)
const (
......
package zap
import (
oid "git.perx.ru/perxis/perxis-go/id"
"git.perx.ru/perxis/perxis-go/log"
"git.perx.ru/perxis/perxis-go/pkg/id"
"git.perx.ru/perxis/perxis-go/pkg/log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
......@@ -71,8 +72,8 @@ func (core *Core) getEntry(entry zapcore.Entry, fields []zapcore.Field) *log.Ent
ent.Category, _ = enc.Fields["category"].(string)
ent.Component, _ = enc.Fields["component"].(string)
ent.Event, _ = enc.Fields["event"].(string)
ent.Object, _ = enc.Fields["object"].(string)
ent.Caller, _ = enc.Fields["caller"].(string)
ent.ObjectID, _ = enc.Fields["object"].(*oid.ObjectId)
ent.CallerID, _ = enc.Fields["caller"].(*oid.ObjectId)
ent.Attr = enc.Fields["attr"]
if tags, ok := enc.Fields["tags"].([]any); ok {
......
......@@ -3,7 +3,7 @@ package zap
import (
"testing"
"git.perx.ru/perxis/perxis-go/pkg/log"
"git.perx.ru/perxis/perxis-go/log"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
......@@ -44,8 +44,8 @@ func TestCore_getEntry(t *testing.T) {
Category: "create",
Component: "Items.Service",
Event: "Items.Create",
Object: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl",
Caller: "/users/PHVz",
ObjectID: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl",
CallerID: "/users/PHVz",
Attr: "any",
Tags: []string{"tag1", "tag2", "tag3"},
},
......
......@@ -6,10 +6,10 @@ import (
"slices"
"testing"
"git.perx.ru/perxis/perxis-go/log"
logmocks "git.perx.ru/perxis/perxis-go/log/mocks"
"git.perx.ru/perxis/perxis-go/pkg/auth"
"git.perx.ru/perxis/perxis-go/pkg/items"
"git.perx.ru/perxis/perxis-go/pkg/log"
logmocks "git.perx.ru/perxis/perxis-go/pkg/log/mocks"
"git.perx.ru/perxis/perxis-go/pkg/users"
usersmocks "git.perx.ru/perxis/perxis-go/pkg/users/mocks"
"github.com/stretchr/testify/mock"
......@@ -25,8 +25,8 @@ func TestExample(t *testing.T) {
Message: "Successfully created",
Component: "Items",
Event: items.EventCreateItem,
Object: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl",
Caller: "/users/294de355",
ObjectID: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl",
CallerID: "/users/294de355",
Tags: []string{"tag1", "tag2", "tag3"},
},
{
......@@ -34,8 +34,8 @@ func TestExample(t *testing.T) {
Message: "Successfully updated",
Component: "Items",
Event: items.EventUpdateItem,
Object: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/cmV2cw",
Caller: "/users/294de355",
ObjectID: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/cmV2cw",
CallerID: "/users/294de355",
Attr: map[string]map[string]any{"title": {"old": "old title", "new": "new title"}},
},
}
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment