-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): update eslint/prettier config
- Loading branch information
1 parent
a8c3b4e
commit 24bb7b9
Showing
9 changed files
with
51 additions
and
51 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,38 +1,4 @@ | ||
import winston, { format } from 'winston'; | ||
|
||
//* Uppercasing must be done before colorizing - https://github.com/winstonjs/winston/issues/1345 | ||
const upperCaseLogLevel = format((info) => { | ||
info.level = info.level?.toUpperCase(); | ||
return info; | ||
}); | ||
|
||
winston.configure({ | ||
level: 'info', | ||
format: format.combine(format.timestamp(), format.errors({ stack: true })), | ||
transports: [ | ||
new winston.transports.File({ | ||
filename: 'logs/error.log', | ||
level: 'error', | ||
maxFiles: 10, | ||
maxsize: 10_000_000, // 10MB | ||
format: format.prettyPrint(), | ||
}), | ||
new winston.transports.Console({ | ||
format: format.combine( | ||
upperCaseLogLevel(), | ||
format.colorize(), | ||
format.align(), | ||
format.printf((info) => { | ||
const message = `[${info.level}] ${info.message}`; | ||
|
||
return info.stack | ||
? message + `\n\t${(info.stack as string).replaceAll('\n', '\n\t')}` | ||
: message; | ||
}) | ||
), | ||
}), | ||
], | ||
}); | ||
|
||
import '@util/logger'; | ||
import Bot from '@classes/bot'; | ||
|
||
export default new Bot(); |
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,35 @@ | ||
import winston, { format } from 'winston'; | ||
|
||
//* Uppercasing must be done before colorizing - https://github.com/winstonjs/winston/issues/1345 | ||
const upperCaseLogLevel = format((info) => { | ||
info.level = info.level?.toUpperCase(); | ||
return info; | ||
}); | ||
|
||
winston.configure({ | ||
level: 'info', | ||
format: format.combine(format.timestamp(), format.errors({ stack: true })), | ||
transports: [ | ||
new winston.transports.File({ | ||
filename: 'logs/error.log', | ||
level: 'error', | ||
maxFiles: 10, | ||
maxsize: 10_000_000, // 10MB | ||
format: format.prettyPrint(), | ||
}), | ||
new winston.transports.Console({ | ||
format: format.combine( | ||
upperCaseLogLevel(), | ||
format.colorize(), | ||
format.align(), | ||
format.printf((info) => { | ||
const message = `[${info.level}] ${info.message}`; | ||
|
||
return info.stack | ||
? `${message}\n\t${(info.stack as string).replaceAll('\n', '\n\t')}` | ||
: message; | ||
}) | ||
), | ||
}), | ||
], | ||
}); |