File

src/app/services/log/publishers/log-publishers.service.ts

Description

Service responsible for giving an array of LogPublisher used for logging.

Index

Properties
Methods
Accessors

Constructor

constructor(environment: IEnvironment)

Log publisher service constructor.

Parameters :
Name Type Optional Description
environment IEnvironment No

The environment

Methods

buildPublishers
buildPublishers()

Build publishers array

Returns : void

Properties

Private _publishers
Type : LogPublisher[]
Default value : []

Public properties

Accessors

publishers
getpublishers()
import { Inject, Injectable } from '@angular/core';
import { LogPublisher } from './publisher/log-publisher';
import { ENV } from 'src/environments/injectionToken/environment-provider';
import { IEnvironment } from 'src/environments/interface/ienvironment';
import { LogConsole } from './console/log-console';
import { LogLocalStorage } from './local-storage/log-local-storage';

/**
 * Service responsible for giving an array of {@link LogPublisher} used for
 * logging.
 */
@Injectable({
  providedIn: 'root',
})
export class LogPublishersService {
  /**
   * Log publisher service constructor.
   *
   * @param environment The environment
   */
  constructor(@Inject(ENV) private environment: IEnvironment) {
    // Build publishers arrays
    this.buildPublishers();
  }

  /** Public properties */
  private _publishers: LogPublisher[] = [];

  public get publishers() {
    return this._publishers;
  }

  /** Build publishers array */
  buildPublishers(): void {
    // Create instance of LogConsole Class
    this._publishers.push(new LogConsole());
    this._publishers.push(new LogLocalStorage(this.environment));
    // pour API : this.publishers.push(new LogWebApi(this.http));
  }
}

results matching ""

    No results matching ""