NebulaLogger

The most robust observability solution for Salesforce experts. Built 100% natively on the platform, and designed to work seamlessly with Apex, Lightning Components, Flow, OmniStudio, and integrations.

View the Project on GitHub jongpie/NebulaLogger

Functions

getUserSettings() ComponentLogger.ComponentLoggerSettings

Returns read-only information about the current user's settings, stored in LoggerSettings__c

setField(fieldToValue)

Sets multiple field values on the builder's LogEntryEvent__e record

setScenario(scenario)

Sets the scenario name for the current transaction - this is stored in LogEntryEvent__e.Scenario__c and Log__c.Scenario__c, and can be used to filter & group logs

exception(message, exception) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.ERROR, automatically saves the log, and then throws the provided exception

error(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.ERROR

warn(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.WARN

info(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.INFO

debug(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.DEBUG

fine(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.FINE

finer(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.FINER

finest(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.FINEST

getBufferSize() Integer

Returns the number of entries that have been generated but not yet saved

flushBuffer()

Discards any entries that have been generated but not yet saved

saveLog(saveMethod)

Saves any entries in Logger's buffer, using the specified save method for only this call All subsequent calls to saveLog() will use the transaction save method

createLogger() Promise.<LoggerService>

Deprecated - use getLogger() instead Async function that returns a fully-loaded logger service. Requires some code to be executed async, so the service is not immediately available. Example: const logger = await createLogger();

getLogger() LoggerService

Recommended approach Synchronous function that returns a ready-to-use logger service. Internally, some code is still executed async, but the service can immediately be used, without awaiting a Promise Example: const logger = getLogger();

getUserSettings() ComponentLogger.ComponentLoggerSettings

Returns read-only information about the current user’s settings, stored in LoggerSettings__c

Kind: global function
Returns: ComponentLogger.ComponentLoggerSettings - The current user’s instance of the Apex class ComponentLogger.ComponentLoggerSettings

setField(fieldToValue)

Sets multiple field values on the builder’s LogEntryEvent__e record

Kind: global function

Param Type Description
fieldToValue Object An object containing the custom field name as a key, with the corresponding value to store. Example: {"SomeField__c": "some value", "AnotherField__c": "another value"}

setScenario(scenario)

Sets the scenario name for the current transaction - this is stored in LogEntryEvent__e.Scenario__c and Log__c.Scenario__c, and can be used to filter & group logs

Kind: global function

Param Type Description
scenario String The name to use for the current transaction’s scenario

exception(message, exception) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.ERROR, automatically saves the log, and then throws the provided exception

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field
exception Error The instance of a JavaScript Error object to use, or an Apex HTTP error to use

error(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.ERROR

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

warn(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.WARN

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

info(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.INFO

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

debug(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.DEBUG

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

fine(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.FINE

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

finer(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.FINER

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

finest(message) LogEntryBuilder

Creates a new log entry with logging level == LoggingLevel.FINEST

Kind: global function
Returns: LogEntryBuilder - The new entry’s instance of LogEntryEventBuilder, useful for chaining methods

Param Type Description
message String The string to use to set the entry’s message field

getBufferSize() Integer

Returns the number of entries that have been generated but not yet saved

Kind: global function
Returns: Integer - The buffer’s current size

flushBuffer()

Discards any entries that have been generated but not yet saved

Kind: global function

saveLog(saveMethod)

Saves any entries in Logger’s buffer, using the specified save method for only this call All subsequent calls to saveLog() will use the transaction save method

Kind: global function

Param Type Description
saveMethod String The enum value of Logger.SaveMethod to use for this specific save action

createLogger() Promise.<LoggerService>

Deprecated - use getLogger() instead Async function that returns a fully-loaded logger service. Requires some code to be executed async, so the service is not immediately available. Example: const logger = await createLogger();

Kind: global function
Returns: Promise.<LoggerService> - A Promise that resolves an instance of LoggerService

getLogger() LoggerService

Recommended approach Synchronous function that returns a ready-to-use logger service. Internally, some code is still executed async, but the service can immediately be used, without awaiting a Promise Example: const logger = getLogger();

Kind: global function
Returns: LoggerService - An instance of LoggerService