C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-core-lib/src/lib/services/tc-logging.service.ts
        
                        Properties | 
                
                        Methods | 
                
                        
  | 
                
| debug | |||||||||
debug(msg: string, ...optionalParams: any[])
                 | 
            |||||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    void
                     | 
            
| error | |||||||||
error(msg: string, ...optionalParams: any[])
                 | 
            |||||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    void
                     | 
            
| fatal | |||||||||
fatal(msg: string, ...optionalParams: any[])
                 | 
            |||||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    void
                     | 
            
| Private formatParams | ||||||
                    
                    formatParams(params: any[])
                 | 
            ||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    string
                     | 
            
| Private getLevelString | ||||
                    
                    getLevelString(level)
                 | 
            ||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    string
                     | 
            
| info | |||||||||
info(msg: string, ...optionalParams: any[])
                 | 
            |||||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    void
                     | 
            
| log | |||||||||
log(msg: string, ...optionalParams: any[])
                 | 
            |||||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    void
                     | 
            
| Private shouldLog | ||||||
                    
                    shouldLog(level: LogLevel)
                 | 
            ||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    boolean
                     | 
            
| warn | |||||||||
warn(msg: string, ...optionalParams: any[])
                 | 
            |||||||||
| 
                     
                        Parameters :
                         
                    
 
                        Returns :          
                    void
                     | 
            
| Private writeToLog | 
                    
                    writeToLog(msg: string, level: LogLevel, params: any[])
                 | 
            
| 
                    
                     
                        Returns :          
                    void
                     | 
            
| level | 
                            Type :         LogLevel
                         | 
                    
                            Default value : LogLevel.All
                         | 
                    
| logWithDate | 
                            Default value : true
                         | 
                    
import { Injectable } from '@angular/core';
@Injectable()
export class LogService {
  level: LogLevel = LogLevel.All;
  logWithDate = true;
  private writeToLog(msg: string,
                     level: LogLevel,
                     params: any[]) {
    if (this.shouldLog(level)) {
      let value = '';
      // Build log string
      if (this.logWithDate) {
        value = new Date() + ' - ';
      }
      value += '[My Cloud Starter] [' + LogLevel[this.level] + '](' + this.getLevelString(level) + ')';
      value += ' - Message: ' + msg;
      if (params.length) {
        value += ' - Extra Info: '
          + this.formatParams(params);
      }
      // Log the value
      console.log(value);
    }
  }
  private shouldLog(level: LogLevel): boolean {
    let ret = false;
    if ((level >= this.level &&
      level !== LogLevel.Off) ||
      this.level === LogLevel.All) {
      ret = true;
    }
    return ret;
  }
  private formatParams(params: any[]): string {
    let ret: string = params.join(',');
    // Is there at least one object in the array?
    if (params.some(p => typeof p === 'object')) {
      ret = '';
      // Build comma-delimited string
      for (const item of params) {
        ret += JSON.stringify(item) + ',';
      }
    }
    return ret;
  }
  debug(msg: string, ...optionalParams: any[]) {
    this.writeToLog(msg, LogLevel.Debug,
      optionalParams);
  }
  info(msg: string, ...optionalParams: any[]) {
    this.writeToLog(msg, LogLevel.Info,
      optionalParams);
  }
  warn(msg: string, ...optionalParams: any[]) {
    this.writeToLog(msg, LogLevel.Warn,
      optionalParams);
  }
  error(msg: string, ...optionalParams: any[]) {
    this.writeToLog(msg, LogLevel.Error,
      optionalParams);
  }
  fatal(msg: string, ...optionalParams: any[]) {
    this.writeToLog(msg, LogLevel.Fatal,
      optionalParams);
  }
  log(msg: string, ...optionalParams: any[]) {
    this.writeToLog(msg, LogLevel.All,
      optionalParams);
  }
  private getLevelString(level) {
    let re = '';
    switch (level) {
      case LogLevel.All: {
        re = 'All';
        break;
      }
      case LogLevel.Debug: {
        re = 'Debug';
        break;
      }
      case LogLevel.Error: {
        re = 'Error';
        break;
      }
      case LogLevel.Fatal: {
        re = 'Fatal';
        break;
      }
      case LogLevel.Info: {
        re = 'Info';
        break;
      }
      case LogLevel.Off: {
        re = 'Off';
        break;
      }
      case LogLevel.Warn: {
        re = 'Warn';
        break;
      }
      default: {
        // statements;
        break;
      }
    }
    return re;
  }
}
export enum LogLevel {
  All = 0,
  Debug = 1,
  Info = 2,
  Warn = 3,
  Error = 4,
  Fatal = 5,
  Off = 6
}