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.
ComponentLogger.ComponentLoggerSettingsReturns read-only information about the current user's settings, stored in LoggerSettings__c
Sets multiple field values on the builder's LogEntryEvent__e record
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
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.ERROR,
automatically saves the log, and then throws the provided exception
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.ERROR
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.WARN
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.INFO
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.DEBUG
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.FINE
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.FINER
LogEntryBuilderCreates a new log entry with logging level == LoggingLevel.FINEST
IntegerReturns the number of entries that have been generated but not yet saved
Discards any entries that have been generated but not yet saved
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
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();
LoggerServiceRecommended 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();
ComponentLogger.ComponentLoggerSettingsReturns 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
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"} |
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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
LogEntryBuilderCreates 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 |
IntegerReturns the number of entries that have been generated but not yet saved
Kind: global function
Returns: Integer - The buffer’s current size
Discards any entries that have been generated but not yet saved
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 |
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
LoggerServiceRecommended 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