aboutsummaryrefslogtreecommitdiff
path: root/src/api/utils/Log.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2021-01-04 01:04:20 +0900
committerPitu <[email protected]>2021-01-04 01:04:20 +0900
commitfcd39dc550dec8dbcb8325e07e938c5024cbc33d (patch)
treef41acb4e0d5fd3c3b1236fe4324b3fef9ec6eafe /src/api/utils/Log.js
parentCreate FUNDING.yml (diff)
parentchore: update todo (diff)
downloadhost.fuwn.me-fcd39dc550dec8dbcb8325e07e938c5024cbc33d.tar.xz
host.fuwn.me-fcd39dc550dec8dbcb8325e07e938c5024cbc33d.zip
Merge branch 'dev'
Diffstat (limited to 'src/api/utils/Log.js')
-rw-r--r--src/api/utils/Log.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/api/utils/Log.js b/src/api/utils/Log.js
new file mode 100644
index 0000000..9a5efc9
--- /dev/null
+++ b/src/api/utils/Log.js
@@ -0,0 +1,36 @@
+const chalk = require('chalk');
+const { dump } = require('dumper.js');
+
+class Log {
+ static info(args) {
+ if (Log.checkIfArrayOrObject(args)) dump(args);
+ else console.log(args); // eslint-disable-line no-console
+ }
+
+ static success(args) {
+ if (Log.checkIfArrayOrObject(args)) dump(args);
+ else console.log(chalk.green(args)); // eslint-disable-line no-console
+ }
+
+ static warn(args) {
+ if (Log.checkIfArrayOrObject(args)) dump(args);
+ else console.log(chalk.yellow(args)); // eslint-disable-line no-console
+ }
+
+ static error(args) {
+ if (Log.checkIfArrayOrObject(args)) dump(args);
+ else console.log(chalk.red(args)); // eslint-disable-line no-console
+ }
+
+ static debug(args) {
+ if (Log.checkIfArrayOrObject(args)) dump(args);
+ else console.log(chalk.gray(args)); // eslint-disable-line no-console
+ }
+
+ static checkIfArrayOrObject(thing) {
+ if (typeof thing === typeof [] || typeof thing === typeof {}) return true;
+ return false;
+ }
+}
+
+module.exports = Log;