logger library
Structured logger for Cloud Logging, compatible with the Firebase
Functions Node.js SDK logger namespace.
Usage
import 'package:firebase_functions/logger.dart';
logger.info('Request received');
logger.warn('Slow query', {'durationMs': 1200, 'query': 'SELECT ...'});
logger.error('Failed to process request');
Structured Logging
Pass a Map<String, Object?> as the second argument to include
structured data in the Cloud Logging jsonPayload:
logger.info('User signed in', {
'userId': user.id,
'provider': 'google',
});
Or pass a Map as the sole argument for structured-only entries:
logger.info({'message': 'Batch complete', 'processedCount': 42});
Severity Routing
- stdout: DEBUG, INFO, NOTICE
- stderr: WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
Classes
- Logger
-
Structured logger for Cloud Logging, compatible with the Firebase
Functions Node.js SDK
loggernamespace.
Enums
- LogSeverity
- Log severity levels for Cloud Logging.
Functions
-
removeCircular(
Object? obj, [Set< Object> ? existingRefs]) → Object? - Removes circular references from an object graph for safe JSON serialization.