Developer / Reference / TypeScript APIs

ScifeonConsoleLogger

Last updated on 13-May-2020 by Jakob Jakobsen Boysen
Jakob Jakobsen Boysen

Platform Lead
boysen@scifeon.com

This class is used for logging to the console from pages, data loaders, etc.

Example

Typically you would want to set the logger on the object (this) using this.logger = logger.

API

constructor(app: any, loggerName: string): ScifeonConsoleLogger

app is the contributions.json parsed as a Javascript-object. The loggerName should be something meaningful, e.g. 'page.customPageId'. When the ScifeonConsoleLogger is injected using dependency injection, these values are automatically set.

logLevel: LogLevel

This is a constant with the values defined in LogLevel.

setLevel(logLevel: LogLevel): void

Sets the level of logging for this logger instance.

Parameters

  • logLevel Matches a value of logLevel specifying the level of logging.

debug(message: string, ...rest: any[]): void

Logs a debug message.

Parameters

  • message: string The message to log.
  • ...rest: any[] The data to log.

Example

info(message: string, ...rest: any[]): void

Logs info.

Parameters

  • message: string The message to log.
  • ...rest: any[] The data to log.

warn(message: string, ...rest: any[]): void

Logs a warning.

Parameters

  • message: string The message to log.
  • ...rest: any[] The data to log.

error(message: string, ...rest: any[]): void

Logs an error.

Parameters

  • message: string The message to log.
  • ...rest: any[] The data to log.