mirror of
https://github.com/lucaspalomodevelop/JSSTE_APP.git
synced 2026-03-13 00:07:22 +00:00
add express logging
This commit is contained in:
parent
9af4b6e223
commit
8ecf2f40b7
@ -19,10 +19,10 @@ console.log = function (d) {
|
||||
log_file.write(d);
|
||||
log_stdout.write(d);
|
||||
};
|
||||
console.error = console.log;
|
||||
|
||||
function getCurrentlog() {
|
||||
return fs.readFileSync(__dirname + "/../../logs/" + name, "utf8").toString();
|
||||
// .replace(/\n/g, "<br>");
|
||||
}
|
||||
|
||||
module.exports = { getCurrentlog };
|
||||
|
||||
@ -15,7 +15,7 @@ websrv.slisten((host, port) => {
|
||||
* Stops the server
|
||||
*/
|
||||
process.on("SIGINT", () => {
|
||||
console.log("\nWeb-Server Beenden ...");
|
||||
console.log("Web-Server Beenden ...");
|
||||
websrv.close();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
@ -10,11 +10,17 @@ module.exports = function (conf) {
|
||||
|
||||
const internalRouter = require("./routes/internalRouter");
|
||||
|
||||
app.use((req, res, next) => {
|
||||
res.on("finish", () => {
|
||||
console.log(`${req.method} ${req.url} ${res.statusCode}`);
|
||||
});
|
||||
next();
|
||||
});
|
||||
app.use(cors());
|
||||
app.use(bodyParser.json());
|
||||
app.use(cookieParser());
|
||||
|
||||
app.use("/api", internalRouter);
|
||||
app.use("/dashboard", express.static(__dirname + "/../../dashboard"));
|
||||
|
||||
app.slisten = function (cb) {
|
||||
app.ServerInstance = app
|
||||
|
||||
@ -5,7 +5,6 @@ const States = require("../../helper/states");
|
||||
const logger = require("../../helper/logger");
|
||||
|
||||
router.get("/conf", (req, res) => {
|
||||
console.log(conf);
|
||||
res.json(conf);
|
||||
});
|
||||
|
||||
|
||||
@ -57,7 +57,6 @@ function test() {
|
||||
</body>
|
||||
</html>`
|
||||
);
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
it("should not rendern _VAR_", function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user