mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 20:43:08 +00:00
fix generate-config-doc.js
It errored out with > Error: Cannot find module '../server/log' Which is expected, but we don't really need it, we can just open code the log functions
This commit is contained in:
parent
f5867c3643
commit
2466c1b1e4
1 changed files with 26 additions and 1 deletions
|
@ -10,10 +10,35 @@
|
|||
|
||||
const {readFileSync, writeFileSync} = require("fs");
|
||||
const colors = require("chalk");
|
||||
const log = require("../server/log").default;
|
||||
const {join} = require("path");
|
||||
const {spawnSync} = require("child_process");
|
||||
|
||||
function timestamp() {
|
||||
const datetime = new Date().toISOString().split(".")[0].replace("T", " ");
|
||||
|
||||
return colors.dim(datetime);
|
||||
}
|
||||
|
||||
const log = {
|
||||
/* eslint-disable no-console */
|
||||
error(...args) {
|
||||
console.error(timestamp(), colors.red("[ERROR]"), ...args);
|
||||
},
|
||||
warn(...args) {
|
||||
console.error(timestamp(), colors.yellow("[WARN]"), ...args);
|
||||
},
|
||||
info(...args) {
|
||||
console.log(timestamp(), colors.blue("[INFO]"), ...args);
|
||||
},
|
||||
debug(...args) {
|
||||
console.log(timestamp(), colors.green("[DEBUG]"), ...args);
|
||||
},
|
||||
raw(...args) {
|
||||
console.log(...args);
|
||||
},
|
||||
/* eslint-enable no-console */
|
||||
};
|
||||
|
||||
function getGitUsername() {
|
||||
return spawnSync("git", ["config", "user.name"], {encoding: "utf8"}).stdout.trim();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue