2021-09-06 14:25:27 +00:00
|
|
|
package storagelog
|
|
|
|
|
|
|
|
import (
|
2024-10-21 07:22:54 +00:00
|
|
|
"context"
|
|
|
|
|
2024-04-10 08:32:35 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
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"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Write writes message about storage engine's operation to logger.
|
2024-10-21 07:22:54 +00:00
|
|
|
func Write(ctx context.Context, logger *logger.Logger, fields ...zap.Field) {
|
|
|
|
logger.Debug(ctx, logs.StorageOperation, fields...)
|
2021-09-06 14:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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))
|
|
|
|
}
|