/ fm / liveswitch / TextLogProvider
Class: TextLogProvider
fm.liveswitch.TextLogProvider
Simple log provider that writes to a local string builder.
Hierarchy
-
↳ TextLogProvider
Table of contents
Constructors
Methods
- clear
- doLog
- generateLogLine
- getCallback
- getFilter
- getLevel
- getPrefix
- getProcessId
- getText
- getTypeString
- log
- setCallback
- setFilter
- setLevel
- getLogLevelString
- getPrefixTimestamp
- getProduct
Constructors
constructor
+ new TextLogProvider(): TextLogProvider
Initializes a new instance of the [[fm.liveswitch.textLogProvider]].
Returns: TextLogProvider
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:18
+ new TextLogProvider(level
: LogLevel): TextLogProvider
Initializes a new instance of the [[fm.liveswitch.textLogProvider]] class.
Parameters:
Name | Type | Description |
---|---|---|
level |
LogLevel | The log level. |
Returns: TextLogProvider
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:25
Methods
clear
▸ clear(): string
Clears all text from the log and returns the former contents.
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:58
doLog
▸ Protected
doLog(logEvent
: LogEvent): void
Logs a message at the specified log level.
Parameters:
Name | Type | Description |
---|---|---|
logEvent |
LogEvent | The log event details. |
Returns: void
Overrides: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:74
generateLogLine
▸ Protected
generateLogLine(logEvent
: LogEvent): string
Generates a default log line.
Parameters:
Name | Type | Description |
---|---|---|
logEvent |
LogEvent | The log event details. |
Returns: string
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:116
getCallback
▸ getCallback(): IAction1<string>
Gets a callback to invoke whenever text is written to the log.
Returns: IAction1<string>
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:87
getFilter
▸ getFilter(): IFunction1<LogEvent, boolean>
Gets a filter on the log provider.
Returning true
will log the event,
while returning false
will skip it.
Returns: IFunction1<LogEvent, boolean>
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:135
getLevel
▸ getLevel(): LogLevel
Gets the log level.
Returns: LogLevel
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:147
getPrefix
▸ Protected
getPrefix(level
: LogLevel, includeTimestamp
: boolean): string
Converts a log-level to a 5-character string for consistently-spaced character sequences.
Parameters:
Name | Type | Description |
---|---|---|
level |
LogLevel | The log level. |
includeTimestamp |
boolean | Whether to include a timestamp in the prefix. |
Returns: string
The log level as an upper-case string with right-side whitespace padding to ensure a 5-character sequence.
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:165
getProcessId
▸ Protected
getProcessId(): number
Gets the current process id.
Returns: number
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:181
getText
▸ getText(): string
Gets the logged text.
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:99
getTypeString
▸ getTypeString(): string
Returns: string
Overrides: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:10
log
▸ log(logEvent
: LogEvent): void
Log a message.
Parameters:
Name | Type | Description |
---|---|---|
logEvent |
LogEvent | The log event details. |
Returns: void
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:194
setCallback
▸ setCallback(value
: IAction1<string>): void
Sets a callback to invoke whenever text is written to the log.
Parameters:
Name | Type |
---|---|
value |
IAction1<string> |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/TextLogProvider.ts:112
setFilter
▸ setFilter(value
: IFunction1<LogEvent, boolean>): void
Sets a filter on the log provider.
Returning true
will log the event,
while returning false
will skip it.
Parameters:
Name | Type |
---|---|
value |
IFunction1<LogEvent, boolean> |
Returns: void
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:220
setLevel
▸ setLevel(value
: LogLevel): void
Sets the log level.
Parameters:
Name | Type |
---|---|
value |
LogLevel |
Returns: void
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:232
getLogLevelString
▸ Static
getLogLevelString(level
: LogLevel): string
Converts a log-level to a 5-character string for consistently-spaced character sequences.
Parameters:
Name | Type | Description |
---|---|---|
level |
LogLevel | The log level. |
Returns: string
The log level as an upper-case string with right-side whitespace padding to ensure a 5-character sequence.
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:53
getPrefixTimestamp
▸ Static
getPrefixTimestamp(timestamp
: DateTime): string
Converts a timestamp to an ISO-8601-formatted string for rendering in a log message (YYYY-MM-DDThh:mm:ss.sssZ).
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
DateTime | The timestamp. |
Returns: string
The timestamp as a formatted string.
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:84
getProduct
▸ Static
getProduct(): string
Returns the name of the current product.
Returns: string
Inherited from: LogProvider
Defined in: Generated/TypeScript/fm.liveswitch/LogProvider.ts:96