Skip to content
Search
DSL · Monolog telemetry bridge

attribute_value_normalizer

Definition

/**
 * Create a AttributeValueNormalizer for converting arbitrary PHP values to Telemetry attribute types.
 *
 * The normalizer handles:
 * - null → 'null' string
 * - scalars (string, int, float, bool) → unchanged
 * - DateTimeInterface → unchanged
 * - Throwable → unchanged
 * - arrays → recursively normalized
 * - objects with __toString() → string cast
 * - objects without __toString() → class name
 * - other types → get_debug_type() result
 *
 * Example usage:
 * ```php
 * $normalizer = attribute_value_normalizer();
 * $normalized = $normalizer->normalize($value);
 * ```
 */
attribute_value_normalizer() : AttributeValueNormalizer

Contributors

Built in the open.

Join us on GitHub
scroll back to top