UNPKG

syp-model

Version:

Simple yet powerful promise-based database model for Node.js

36 lines (35 loc) 915 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class MyLogger { constructor(enabled = true) { /** enable/disable logging */ this.isEnabled = null; this.isEnabled = enabled; } /** print a newline */ newline() { console.log(); } /** Log data * @param x? data to log. If no argument is given, a newline is logged. */ log(x) { if (!this.isEnabled) return; // If no argument is provided if (typeof (x) == 'undefined') return console.log(); else return console.log(x); } /** Log with an extra newline at the end * @param x? data to log. If no argument is given, two newlines are logged. */ logln(x) { if (!this.isEnabled) return; this.log(x); this.newline(); } } exports.default = MyLogger;