-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BRS-642: Updates for facility/role handling as well as unified logger. (
#119) * BRS-642: Updates for facility/role handling as well as unified logger. * Fix for isAdmin. * Changed logic slightly.
- Loading branch information
Showing
17 changed files
with
233 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
const { createLogger, format, transports } = require('winston'); | ||
const { combine, timestamp, printf } = format; | ||
const { combine, timestamp } = format; | ||
|
||
const myFormat = printf(({ level, message, label, timestamp }) => { | ||
return `${timestamp} ${level}: ${message}`; | ||
}); | ||
|
||
const LEVEL = process.env.LOG_LEVEL || 'info'; | ||
const LEVEL = process.env.LOG_LEVEL || 'error'; | ||
|
||
exports.logger = createLogger({ | ||
level: LEVEL, | ||
format: combine( | ||
timestamp(), | ||
myFormat | ||
format.printf((info) => { | ||
let meta = '' | ||
let symbols = Object.getOwnPropertySymbols(info) | ||
if (symbols.length == 2) { | ||
meta = JSON.stringify(info[symbols[1]]) | ||
|
||
} | ||
return `${info.timestamp} ${[info.level.toUpperCase()]}: ${info.message} ${meta}`; | ||
}) | ||
), | ||
transports: [new transports.Console()] | ||
}); |
Oops, something went wrong.