aboutsummaryrefslogtreecommitdiff
path: root/src/api/utils/Log.js
diff options
context:
space:
mode:
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;