aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBuildTools <unconfigured@null.spigotmc.org>2017-10-01 11:58:46 +0200
committerBuildTools <unconfigured@null.spigotmc.org>2017-10-01 11:58:46 +0200
commit4a0addeb2a8e1c57e7bd4dba62a238825752283d (patch)
tree1ff3c9eb94cadef084f48ab0e478ed0a413e48b9
parentlog files (diff)
log dates
-rw-r--r--app.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/app.js b/app.js
index 8a4313b..0c4aa64 100644
--- a/app.js
+++ b/app.js
@@ -9,8 +9,8 @@ const converter = new showdown.Converter();
const app = express();
const path = 'md';
-const access = fs.createWriteStream('node.access.log', {flags: 'a'});
-const error = fs.createWriteStream('node.error.log', {flags: 'a'});
+const access = fs.createWriteStream('node.access.log');
+const error = fs.createWriteStream('node.error.log');
process.stdout.write = access.write.bind(access);
process.stderr.write = error.write.bind(error);
@@ -25,7 +25,7 @@ converter.setOption('tasklists', 'true');
app.use(express.static('public'));
app.get('/' + path + '/*', function(req, res) {
- console.log("200 - " + req.url);
+ console.log("[" + new Date() + "] > " + "200 - " + req.url);
fs.readFile(req.url.substr(1), 'utf8', function(err, data) {
if (err)
return console.log(err);
@@ -34,19 +34,19 @@ app.get('/' + path + '/*', function(req, res) {
});
app.get('/data', function(req, res) {
- console.log("200 - " + req.url);
+ console.log("[" + new Date() + "] > " + "200 - " + req.url);
res.send(dirTree(path, {extensions:/\.md/}));
});
app.get('/img/*', function (req, res) {
- console.log("200 - " + req.url);
+ console.log("[" + new Date() + "] > " + "200 - " + req.url);
var img = fs.readFileSync(req.url.replace('/img', path));
res.writeHead(200, {'Content-Type': 'image/gif' });
res.end(img, 'binary');
});
app.get('/', function(req, res) {
- console.log("200 - " + req.url);
+ console.log("[" + new Date() + "] > " + "200 - " + req.url);
fs.readFile('public/index.html', 'utf8', function(err, data) {
if (err)
return console.log(err);
@@ -55,7 +55,7 @@ app.get('/', function(req, res) {
});
app.get('*', function(req, res) {
- console.error("404 - " + req.url);
+ console.log("[" + new Date() + "] > " + "404 - " + req.url);
fs.readFile('public/404.md', 'utf8', function(err, data) {
if (err)
return console.log(err);