123456789101112131415161718192021222324252627282930313233 |
- "use strict";
- const config_config = require("../config/config.js");
- class log {
- static Debug(msg, ...other) {
- if (config_config.config.LOG_OPEN) {
- console.log(msg, other.length > 0 ? other[0] : "", log.stack());
- }
- }
- static stack() {
- let callingLocation = "";
- try {
- throw new Error();
- } catch (e) {
- const stack = e.stack;
- const lines = stack.split("\n");
- if (lines.length >= 4) {
- callingLocation = lines[3];
- }
- }
- return callingLocation;
- }
- static Error(msg, ...other) {
- if (config_config.config.LOG_OPEN) {
- console.error(msg, other.length > 0 ? other[0] : "");
- }
- }
- static Info(msg, ...other) {
- if (config_config.config.LOG_OPEN) {
- console.info(msg, other.length > 0 ? other[0] : "");
- }
- }
- }
- exports.log = log;
|