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 ( ...@@ -5,8 +5,8 @@ import (
"sync" "sync"
"time" "time"
"git.perx.ru/perxis/perxis-go/log"
"git.perx.ru/perxis/perxis-go/pkg/errors" "git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/log"
) )
const ( const (
......
package zap package zap
import ( 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/id"
"git.perx.ru/perxis/perxis-go/pkg/log"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
) )
...@@ -71,8 +72,8 @@ func (core *Core) getEntry(entry zapcore.Entry, fields []zapcore.Field) *log.Ent ...@@ -71,8 +72,8 @@ func (core *Core) getEntry(entry zapcore.Entry, fields []zapcore.Field) *log.Ent
ent.Category, _ = enc.Fields["category"].(string) ent.Category, _ = enc.Fields["category"].(string)
ent.Component, _ = enc.Fields["component"].(string) ent.Component, _ = enc.Fields["component"].(string)
ent.Event, _ = enc.Fields["event"].(string) ent.Event, _ = enc.Fields["event"].(string)
ent.Object, _ = enc.Fields["object"].(string) ent.ObjectID, _ = enc.Fields["object"].(*oid.ObjectId)
ent.Caller, _ = enc.Fields["caller"].(string) ent.CallerID, _ = enc.Fields["caller"].(*oid.ObjectId)
ent.Attr = enc.Fields["attr"] ent.Attr = enc.Fields["attr"]
if tags, ok := enc.Fields["tags"].([]any); ok { if tags, ok := enc.Fields["tags"].([]any); ok {
......
...@@ -3,7 +3,7 @@ package zap ...@@ -3,7 +3,7 @@ package zap
import ( import (
"testing" "testing"
"git.perx.ru/perxis/perxis-go/pkg/log" "git.perx.ru/perxis/perxis-go/log"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
...@@ -44,8 +44,8 @@ func TestCore_getEntry(t *testing.T) { ...@@ -44,8 +44,8 @@ func TestCore_getEntry(t *testing.T) {
Category: "create", Category: "create",
Component: "Items.Service", Component: "Items.Service",
Event: "Items.Create", Event: "Items.Create",
Object: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl", ObjectID: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl",
Caller: "/users/PHVz", CallerID: "/users/PHVz",
Attr: "any", Attr: "any",
Tags: []string{"tag1", "tag2", "tag3"}, Tags: []string{"tag1", "tag2", "tag3"},
}, },
......
...@@ -6,10 +6,10 @@ import ( ...@@ -6,10 +6,10 @@ import (
"slices" "slices"
"testing" "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/auth"
"git.perx.ru/perxis/perxis-go/pkg/items" "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" "git.perx.ru/perxis/perxis-go/pkg/users"
usersmocks "git.perx.ru/perxis/perxis-go/pkg/users/mocks" usersmocks "git.perx.ru/perxis/perxis-go/pkg/users/mocks"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
...@@ -25,8 +25,8 @@ func TestExample(t *testing.T) { ...@@ -25,8 +25,8 @@ func TestExample(t *testing.T) {
Message: "Successfully created", Message: "Successfully created",
Component: "Items", Component: "Items",
Event: items.EventCreateItem, Event: items.EventCreateItem,
Object: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl", ObjectID: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/W0fl",
Caller: "/users/294de355", CallerID: "/users/294de355",
Tags: []string{"tag1", "tag2", "tag3"}, Tags: []string{"tag1", "tag2", "tag3"},
}, },
{ {
...@@ -34,8 +34,8 @@ func TestExample(t *testing.T) { ...@@ -34,8 +34,8 @@ func TestExample(t *testing.T) {
Message: "Successfully updated", Message: "Successfully updated",
Component: "Items", Component: "Items",
Event: items.EventUpdateItem, Event: items.EventUpdateItem,
Object: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/cmV2cw", ObjectID: "/spaces/WPNN/envs/9VGP/cols/GxNv/items/cmV2cw",
Caller: "/users/294de355", CallerID: "/users/294de355",
Attr: map[string]map[string]any{"title": {"old": "old title", "new": "new title"}}, 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.
Please register or to comment