/
logger.js
45 lines (40 loc) · 1002 Bytes
/
logger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const process = require("node:process");
const bunyan = require("bunyan");
const configuration = require("./configuration");
const bunyanConfig = {
name: "ftrf-web",
// TODO: make level logging an option.
// level: "error",
// TODO: make src logging an option, disabled in production.
// src: true,
// TODO: streams should be a part of per-app configuration.
streams: [
//
// Should stderr output be on as well?
// {
// type: "stream",
// level: "error",
// stream: process.stderr
// },
//
{
level: configuration.loggingLevel,
stream: process.stdout,
type: "stream",
},
//
// {
// type: "rotating-file",
// // TODO: use path from configuration so that there's one log path per app.
// path: "ftrf-web.log",
// // Daily rotation.
// period: "1d",
// // Keep three files.
// count: 3,
// level: "trace",
// },
//
],
};
const logger = bunyan.createLogger(bunyanConfig);
module.exports = logger;