mirror of
https://github.com/UiO-Gaming/infoscreen3.git
synced 2026-11-05 13:56:52 +01:00
* Update npm dependencies * Change config to use environmental variables, * Fix videos to actually show (modern browsers needs muted volume) * Fix videos to load actually for lite and css views * Provide zip with precompiled binaries for super-easy setup
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
import 'dotenv/config'
|
|
import chalk from 'chalk';
|
|
let lastStamp = "";
|
|
|
|
export default {
|
|
error: function (error, title) {
|
|
if (title == null) {
|
|
title = "";
|
|
}
|
|
this.log(chalk.bold.red("[Error]" + title) + " " + error);
|
|
},
|
|
|
|
info: function (string, category) {
|
|
|
|
this.log(chalk.cyan("[" + (category || "Info") + "] ") + string);
|
|
},
|
|
|
|
debug: function (string) {
|
|
console.log(chalk.bold.black("[Debug] " + string));
|
|
},
|
|
|
|
success: function (string) {
|
|
this.log(string + chalk.green(" [Success]"));
|
|
},
|
|
|
|
log: function (string) {
|
|
if (process.env.DEBUG != "true") return;
|
|
let now = getDateTime();
|
|
if (lastStamp != now) {
|
|
lastStamp = now;
|
|
now = "\n" + now + "\n"
|
|
} else {
|
|
now = "";
|
|
}
|
|
|
|
console.log(now + string);
|
|
}
|
|
};
|
|
|
|
function getDateTime() {
|
|
|
|
var date = new Date();
|
|
|
|
var hour = date.getHours();
|
|
hour = (hour < 10 ? "0" : "") + hour;
|
|
|
|
var min = date.getMinutes();
|
|
min = (min < 10 ? "0" : "") + min;
|
|
|
|
var sec = date.getSeconds();
|
|
sec = (sec < 10 ? "0" : "") + sec;
|
|
|
|
var year = date.getFullYear();
|
|
|
|
var month = date.getMonth() + 1;
|
|
month = (month < 10 ? "0" : "") + month;
|
|
|
|
var day = date.getDate();
|
|
day = (day < 10 ? "0" : "") + day;
|
|
|
|
return year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec;
|
|
|
|
} |