All files / app/services/log/publishers log-publishers.service.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 3/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                            1x           846x   846x       846x     1764x           846x 846x        
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));
  }
}