Log Service
8.1 LogService — Structured logging
Runs in: both worker and view.
Permission required: None.
interface ILogService {
debug(message: string): void;
info(message: string): void;
warn(message: string): void;
error(message: string | Error): void;
custom(message: string, category: string, colorName: string, frameName?: string): void;
}
Usage:
const log = context.getService<ILogService>('log');
log.debug('Rendering item list');
log.info('Extension initialized');
log.warn('Rate limit approaching');
log.error(new Error('API request failed'));
log.custom('User selected item #3', 'UI', 'cyan', 'MyExtension');
Log messages appear in Asyar's developer log panel (accessible from the tray menu).
Guidelines:
- Use
debugfreely during development for trace-level output. - Use
infofor lifecycle events (initialize, activate, first data load). - Use
warnfor recoverable edge cases (fallback values, deprecated usage). - Use
erroronly for actual failures that affect behavior. customlets you add a color and category label for visual grouping in the log panel.