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

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4

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                              641x 641x           2x 2x      
import { Observable, of } from 'rxjs';
import { LogPublisher } from '../publisher/log-publisher';
import { LogEntry } from '../../logEntry/logEntry';
 
/** Console {@link LogPublisher}. Used to log in console. */
export class LogConsole extends LogPublisher {
  /**
   * Method used to actually log a {@link LogEntry}. Returns
   *
   * @param entry The {@link LogEntry} to log
   * @returns A boolean indicating if the entry was logged.
   */
  log(entry: LogEntry): Observable<boolean> {
    // Log to console
    // eslint-disable-next-line no-console
    console.log(entry.buildLogString());
    return of(true);
  }
 
  /** Method used to clear the console */
  clear(): Observable<boolean> {
    // eslint-disable-next-line no-console
    console.clear();
    return of(true);
  }
}