@salesforce/b2c-tooling-sdk / operations/logs / listLogFiles
Function: listLogFiles()
listLogFiles(
instance,options):Promise<LogFile[]>
Defined in: packages/b2c-tooling-sdk/src/operations/logs/list.ts:155
Lists log files on a B2C Commerce instance.
Filters in ListLogsOptions.prefixes are matched in one of two ways:
- Prefix filters (no
/, e.g."error") match the extracted log-category prefix of files in the top-levelLogs/directory. - Path filters (contain a
/, e.g."internal/server") recurse into the named subdirectory ofLogs/and match against each file's path relative toLogs/. This is the only case that lists subdirectories — by default only the top-levelLogs/directory is scanned.
Parameters
instance
B2C instance to list logs from
options
ListLogsOptions = {}
Listing options (filters, sorting)
Returns
Promise<LogFile[]>
Array of log files
Example
typescript
// List all error and customerror logs (top-level)
const logs = await listLogFiles(instance, {
prefixes: ['error', 'customerror'],
sortBy: 'date',
sortOrder: 'desc'
});
// List server logs in the internal/ subdirectory
const internal = await listLogFiles(instance, {prefixes: ['internal/server']});