Skip to content
View as Markdown
View as Markdown

@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-level Logs/ directory.
  • Path filters (contain a /, e.g. "internal/server") recurse into the named subdirectory of Logs/ and match against each file's path relative to Logs/. This is the only case that lists subdirectories — by default only the top-level Logs/ directory is scanned.

Parameters

instance

B2CInstance

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']});

Released under the Apache-2.0 License.