Skip to content

@salesforce/b2c-tooling-sdk / operations/logs / extractPrefix

Function: extractPrefix() ​

extractPrefix(filename): string

Defined in: packages/b2c-tooling-sdk/src/operations/logs/list.ts:56

Extracts the log prefix from a filename.

Parameters ​

filename ​

string

Log file name (e.g., "error-blade1-20250125.log")

Returns ​

string

The prefix (e.g., "error") or "unknown"

Example ​

ts
extractPrefix("error-blade1-20250125.log") // "error"
extractPrefix("customerror-blade1-20250125.log") // "customerror"
extractPrefix("custom-mylog-blade1-20250125.log") // "custom-mylog"

Released under the Apache-2.0 License.