mirror of
https://github.com/UiO-Gaming/infoscreen3.git
synced 2026-11-05 22:04:33 +01:00
- Updated package.json to replace pkg with nexe for building executables. - Added rebuild-native-node20.js for rebuilding native modules for Node.js 20.18.1. - Introduced test-exe.js to facilitate testing of the generated executable. - Modified webpack.config.cjs to output bundle.cjs and set libraryTarget to commonjs2. - Enhanced profiler plugin for memory usage tracking with simplified output. - Removed unused dependencies and updated existing ones in package.json.
62 lines
1.4 KiB
JavaScript
62 lines
1.4 KiB
JavaScript
import 'dotenv/config'
|
|
let lastStamp = "";
|
|
|
|
export default {
|
|
error: function (error, title) {
|
|
if (title == null) {
|
|
title = "";
|
|
}
|
|
this.log("[Error]" + title + " " + error);
|
|
},
|
|
|
|
info: function (string, category) {
|
|
|
|
this.log("[" + (category || "Info") + "] " + string);
|
|
},
|
|
|
|
debug: function (string) {
|
|
console.log("[Debug] " + string);
|
|
},
|
|
|
|
success: function (string) {
|
|
this.log(string + " [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;
|
|
|
|
} |