All files / src/logger logger.ts

100% Statements 7/7
100% Branches 2/2
100% Functions 2/2
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  26x   26x         26x             2x 1x                   4x 1x        
// tslint:disable: no-console
import { Config, Mode } from '../config';
 
const DEVELOPMENT_MODE: Mode = 'development';
 
/**
 * Class to log messages
 */
export class Logger {
	/**
	 * Prints an warn message to the browser console only
	 * if the application is in development mode.
	 * @param message
	 */
	public static warn(message: string) {
		if (Config.mode === DEVELOPMENT_MODE) {
			console.warn(message);
		}
	}
 
	/**
	 * Prints an error message to the browser console only
	 * if the application is in development mode.
	 * @param message
	 */
	public static error(message: string) {
		if (Config.mode === DEVELOPMENT_MODE) {
			console.error(message);
		}
	}
}