Function: getCategoryLogger()¶
getCategoryLogger(
category):CategoryLogger
Creates a CategoryLogger for convenient logging with a consistent category.
Parameters¶
category¶
string
The category to use for all logs from this logger
Returns¶
A CategoryLogger instance wrapping the global logger
Since¶
0.42.0
Example¶
TypeScript
const authLogger = getCategoryLogger('auth');
const dbLogger = getCategoryLogger('database');
const apiLogger = getCategoryLogger('api');
authLogger.info('User login', { values: ['user123'] });
dbLogger.error('Query timeout');
apiLogger.warn('Rate limit exceeded', { values: [100, 'req/min'] });
// All logs are in the same global logger, but categorized
const df = getLogger().toDataFrame();
const authLogs = df.filter(row => row.category === 'auth');