For Developers
Apex and Lightning Web Component quick starts, fluent logging API, and save methods.
Nebula Logger gives Apex and Lightning Web Component developers a single, fluent logging API instead of scattered System.debug() calls that disappear the moment the transaction ends.
Apex quick start
Logger.error('Add log entry using Nebula Logger with logging level == ERROR');
Logger.warn('Add log entry using Nebula Logger with logging level == WARN');
Logger.info('Add log entry using Nebula Logger with logging level == INFO');
Logger.debug('Add log entry using Nebula Logger with logging level == DEBUG');
Logger.fine('Add log entry using Nebula Logger with logging level == FINE');
Logger.finer('Add log entry using Nebula Logger with logging level == FINER');
Logger.finest('Add log entry using Nebula Logger with logging level == FINEST');
Logger.saveLog();
Each call becomes one Log__c record with related LogEntry__c records — queryable, reportable, and dashboard-able like any other Salesforce data.
Lightning components
import { getLogger } from 'c/logger';
export default class LoggerDemo extends LightningElement {
logger = getLogger();
connectedCallback() {
this.logger.info('Hello, world');
this.logger.saveLog();
}
}<aura:component implements="force:appHostable">
<c:logger aura:id="logger" />
</aura:component>const logger = component.find('logger');
logger.error('Hello, world!').addTag('tag');
logger.saveLog();Fluent interface
Methods chain, so you can attach records, tags, and custom fields in one line:
Logger.debug('my string').setRecord(currentUser);
Logger.debug('message').addTag('important');
Save methods
Logging shouldn’t slow down your transaction. Nebula Logger supports four ways to persist logs, controlled per-transaction or globally:
Logger.setSaveMethod(Logger.SaveMethod.EVENT_BUS);
// Publishes LogEntryEvent__e platform events — fully async, no governor limit impactLogger.setSaveMethod(Logger.SaveMethod.QUEUEABLE);
// Defers processing to an async queueable jobLogger.setSaveMethod(Logger.SaveMethod.REST);
// Synchronous callout using the current session IDLogger.setSaveMethod(Logger.SaveMethod.SYNCHRONOUS_DML);
// Immediate Log__c / LogEntry__c creation in the current transactionTransaction controls
Logger.suspendSaving()/Logger.resumeSaving()— pause and resume persistence mid-transactionLogger.flushBuffer()— discard unsaved entries entirelyLogger.setParentLogTransactionId(String)— stitch batch and queueable jobs back to the log that kicked them off
For ISVs: optional dependency
Package developers can call Nebula Logger without a hard dependency, using the Callable interface:
Type nebulaLoggerType = Type.forName('Nebula', 'CallableLogger') ?? Type.forName('CallableLogger');
Callable nebulaLoggerInstance = (Callable) nebulaLoggerType?.newInstance();