File

src/helpers/info-logger.ts

Description

Logger for logging event display data

Index

Properties
Methods

Properties

Private infoLoggerList
Type : any[]
Default value : []

List that contains all the info logs

Private maxEntries
Type : number
Default value : 10

Max entries to be shown inside the information panel

Methods

add
add(data: string, label?: string)

Add an entry to the info logger

Parameters :
Name Type Optional Description
data string No

Data of the info log

label string Yes

Label of the info log

Returns : void
getInfoLoggerList
getInfoLoggerList()

Get the info logger list being used by the info logger service

Returns : any[]

The info logger list containing log data

export class InfoLogger {
  /** List that contains all the info logs */
  private infoLoggerList: any[] = [];
  /** Max entries to be shown inside the information panel */
  private maxEntries: number = 10;

  /**
   * Add an entry to the info logger
   * @param data Data of the info log
   * @param label Label of the info log
   */
  add(data: string, label?: string) {
    if (this.infoLoggerList.length > this.maxEntries) {
      this.infoLoggerList.pop();
    }
    this.infoLoggerList.unshift(label ? label + ': ' + data : data);
  }

  /**
   * Get the info logger list being used by the info logger service
   * @returns The info logger list containing log data
   */
  getInfoLoggerList(): any[] {
    return this.infoLoggerList;
  }
}

results matching ""

    No results matching ""