Skip to content

Class: LoggerManager

Hierarchy

  • LoggerManager

Summary

Methods

Class Methods

Inherited Methods

Methods

getLevel

getLevel(): string

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:83

Returns the log level of the root Logger.

Returns: string


getLevelFromUserDefaults

getLevelFromUserDefaults(): string

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:129

Gets the level from user stored settings from the key 'AppModeler_logLevel'

Returns: string


isLogSeverityHigher

isLogSeverityHigher(severity: string): boolean

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:76

Check if loglevel is higher than serverity or not

Parameters:

Name Type Description
severity string The severity level. It's values can be: Error, Warn, Info, Debug, Off.

Returns: boolean


isTurnedOn

isTurnedOn(): boolean

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:67

Returns true, if the Logger is turned On. Otherwise returns false.

Returns: boolean


log

log(message: string, severity: string, logToConsole: boolean): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:101

Logs a message, if the logger is turned on.

Parameters:

Name Type Default Description
message string - The message to be logged.
severity string undefined Optional. The severity of the log level for logging this message. If the severity parameter is not specified or invalid, the root log level will be used.
logToConsole boolean true -

Returns: Promise‹any›


logTraceToFile

logTraceToFile(message: string, category: string, type: number): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:111

Writes a message to log file and console as well.

Parameters:

Name Type Default Description
message string - The message to be written.
category string - The category of the message.
type number 0 Optional, the type of the message - info, warning, error.

Returns: Promise‹any›


off

off(): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:59

Turns off the logger.

Returns: Promise‹any›


on

on(): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:52

Turns on the logger. If it has not been changed, the default log level is 'Error'.

Returns: Promise‹any›


setLevel

setLevel(newLevel: string): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:91

Sets the log level and updates the logger state accordingly (turns it on/off).

Parameters:

Name Type Description
newLevel string The log level. It's values can be: Error, Warn, Info, Debug, Off.

Returns: Promise‹any›


toggle

toggle(): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:44

If the logger is turned off, then it will be turned on. Otherwise it will be turned off.

Returns: Promise‹any›


uploadLogFile

uploadLogFile(backendURL: string, applicationID: string): Promise‹any›

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:120

Uploads the current set of logs (logs since the last upload) to the backend URL with app ID.

Parameters:

Name Type Description
backendURL string The backend URL.
applicationID string The application ID.

Returns: Promise‹any›


Static clearLog

clearLog(): void

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:32

Static function to clear log and set the LoaggerManager's status to non-initialized

Returns: void


Static getInstance

getInstance(): any

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:25

Static function to return the singleton instance of the LoggerManager. If it has not been initialized yet, it throws exception.

throws Error Throws error if calling before initilizing LoggerManager.

Returns: any

the instance of the LoggerManager .


Static init

init(logFileName: string, maxFileSizeInMegaBytes: number): void

Defined in src/SnowblindClientApplication/plugins/SAP/Foundation/Common/Logger/LoggerManager.ts:15

Static initializer to initializes the LoggerManager and adds the log file handlers. Example:

LoggerManager.init("log.txt", 3)

Parameters:

Name Type Default Description
logFileName string "ClientLog.txt" Optional, File name of the local log file on the client device. If missing, default value is ClientLog.txt
maxFileSizeInMegaBytes number 1 Optional, Max file size before rollover of the local log file on the client device. If missing, default value is 1MB. The default root log level is 'Error', according to SAP SDK.

Returns: void