2021-09-06 14:25:27 +00:00
|
|
|
package storagelog
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
2021-09-06 14:25:27 +00:00
|
|
|
"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.
|
2023-02-21 11:42:45 +00:00
|
|
|
func AddressField(addr any) zap.Field {
|
2021-09-06 14:25:27 +00:00
|
|
|
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))
|
|
|
|
}
|