frostfs-node/pkg/local_object_storage/internal/log/log.go
Dmitrii Stepanov 6db46257c0
[] node: Use ctx for logging
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-11-13 10:36:07 +03:00

36 lines
992 B
Go

package storagelog
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"go.uber.org/zap"
)
// Write writes message about storage engine's operation to logger.
func Write(ctx context.Context, logger *logger.Logger, fields ...zap.Field) {
logger.Debug(ctx, logs.StorageOperation, fields...)
}
// AddressField returns logger's field for object address.
//
// Address should be type of *object.Address or string.
func AddressField(addr any) zap.Field {
return zap.Any("address", addr)
}
// OpField returns logger's field for operation type.
func OpField(op string) zap.Field {
return zap.String("op", op)
}
// 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))
}