getLogPropertyValue
Retrieves the value of a custom logging property.
Syntax
Copy
function getLogPropertyValue(key: string): string
| Parameter | Description |
|---|---|
key
|
Custom key to be included in the log message properties. |
Return Value
Returns a string containing the value of the custom log property.
Examples
In this example:
- We use the ftos.logging.setProperty function to define a custom log property called fooKey and assign it the fooValue value.
- We store the key's value in the x variable.
- We ftos.logging.log a message that emphasizes the value of the fooKey custom logging property.
Copy
setLogProperty('fooKey', 'fooValue');
var x = getLogPropertyValue('fooKey');
log('Check out the fooKey custom property below which is set to ' + x);
The resulting log message will be similar to the one below:
Copy
-[START]---------------------------------------
Timestamp: 17/12/2021 02:10:56 PM
Message: Check out the fooKey custom property below which is set to fooValue
Severity: Information
Exception:
Properties: { CorrelationId: "23cdb1f5-0529-4377-b200-399efb8bc32f", PortalProfile: null, MachineName: "FTOSBUCLP385", Language: "en-GB", Source: "Platform", fookey: "fooValue", automationscript: "sample-script-log-api" }
-[END]---------------------------------------