2021-09-06 14:25:27 +00:00
|
|
|
package storagelog
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2022-10-17 12:03:55 +00:00
|
|
|
// headMsg is a distinctive part of all messages.
|
2021-09-06 14:25:27 +00:00
|
|
|
const headMsg = "local object storage operation"
|
|
|
|
|
|
|
|
// Write writes message about storage engine's operation to logger.
|
|
|
|
func Write(logger *logger.Logger, fields ...zap.Field) {
|
|
|
|
logger.Info(headMsg, fields...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddressField returns logger's field for object address.
|
|
|
|
//
|
|
|
|
// Address should be type of *object.Address or string.
|
|
|
|
func AddressField(addr interface{}) zap.Field {
|
|
|
|
return zap.Any("address", addr)
|
|
|
|
}
|
|
|
|
|
2022-07-30 07:22:26 +00:00
|
|
|
// OpField returns logger's field for operation type.
|
2021-09-06 14:25:27 +00:00
|
|
|
func OpField(op string) zap.Field {
|
|
|
|
return zap.String("op", op)
|
|
|
|
}
|
2022-10-21 17:50:33 +00:00
|
|
|
|
|
|
|
// StorageTypeField returns logger's field for storage type.
|
|
|
|
func StorageTypeField(typ string) zap.Field {
|
|
|
|
return zap.String("type", typ)
|
|
|
|
}
|
|
|
|
|
|
|
|
// StorageIDField returns logger's field for storage ID.
|
|
|
|
func StorageIDField(id []byte) zap.Field {
|
|
|
|
return zap.String("storage_id", string(id))
|
|
|
|
}
|