removelevelbutton tests

This commit is contained in:
realaravinth
2021-05-07 17:55:42 +05:30
parent 7b3f910da7
commit 5b5a995f57
19 changed files with 1100 additions and 204 deletions

View File

@@ -14,24 +14,44 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {mode, MODE} from './env';
/** Conditional logger singleton */
export const log = (function() {
const log = (function() {
let mode = MODE.production;
return {
/** get levels */
/** console.error() wrapper */
debug: (data: any) => {
if (mode == MODE.none) {
return;
}
if (mode == MODE.development) {
console.debug(data);
}
},
/** console.error() wrapper */
error: (data: any) => {
console.error(data);
},
/** console.log() wrapper */
log: (data: any) => {
if (mode == MODE.none) {
return;
}
console.log(data);
},
/** set logging mode */
setMode: (newMode: MODE) => (mode = newMode),
};
})();
export const enum MODE {
production,
development,
none,
}
export default log;