-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: Estilo de cores e nome padrão para o Instagram; Merge branch 'master' of https://github.com/teogenesmoura/spreadsheetsGoogle
- Loading branch information
Showing
11 changed files
with
486 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.DS_Store | ||
/node_modules | ||
credentials.json | ||
credentials.json | ||
controllers/*.png | ||
yarn-error.log | ||
logs/ |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const winston = require("winston"); | ||
const fs = require("fs"); | ||
|
||
const format = winston.format; | ||
const { combine, printf } = format; | ||
|
||
// Create the logs directory if it does not exist | ||
const logDir = "logs"; | ||
if (!fs.existsSync(logDir)) { | ||
fs.mkdirSync(logDir); | ||
} | ||
|
||
const customLevels = { | ||
levels: { | ||
trace: 4, | ||
info: 3, | ||
warn: 2, | ||
error: 1, | ||
critical: 0, | ||
}, | ||
colors: { | ||
trace: "gray", | ||
info: "green", | ||
warn: "yello", | ||
error: "red", | ||
critical: "purple", | ||
}, | ||
}; | ||
|
||
const tsLvlMsgFormat = printf((info) => { | ||
return `[${info.timestamp}] - [${info.level}] - ${info.message}`; | ||
}); | ||
|
||
winston.addColors(customLevels.colors); | ||
|
||
const logger = winston.createLogger({ | ||
level: "info", | ||
format: combine( | ||
winston.format.timestamp({ | ||
format: "YYYY-MM-DD HH:mm:ss", | ||
}), | ||
tsLvlMsgFormat, | ||
), | ||
transports: [ | ||
// | ||
// - Write to all logs with level `info` and below to `combined.log` | ||
// - Write all logs error (and below) to `error.log`. | ||
// | ||
new winston.transports.Console({ level: "info" }), | ||
new winston.transports.File({ filename: "logs/error.log", level: "error" }), | ||
new winston.transports.File({ filename: "logs/combined.log" }), | ||
], | ||
levels: customLevels.levels, | ||
}); | ||
|
||
module.exports = logger; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.