You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A logger manager is to be created following the specifications below, keep in mind that this should be instanced right after the ConfigManager since practically everything depends on it.
Configuration
interfaceIConfig{
...,logger: {disabled?: boolean// Whether logging should be disabled entirely.all?: boolean// Whether to log everything or not, if disabled, non-important logs will be omitted.bootup?: boolean// Whether to log client startup, shutdown, etc. or not. Will include sharding, when implemented.loading?: boolean// ... log loading 'events' or not, such as commands and events loading.sentry?: ConstructorOptions// Configuration for sentry.io using raven, if omitted, a file will be generated instead.}}
Note about <IConfig>.logger.all
This is a configuration that will enable all the other options below of it, however, this also will enable debug logs across the board, including typeorm's and discord.js's debug logs.
If chalk isn't being used, a bg<Name> property needs to be added to each one, otherwise, use the same color. Text should generally always be white, but, when emphasis is needed you can use the <LogColor>.EMPHASIS color.
NOTE - If there are readability issues with any of these colors, please comment over them and we'll arrange a new color.
Features
Access colors
Colors should be accessed via their names, like <LoggerManager>.info(message: string, isBackground?: boolean).
Logging (obviously)
This should be either accessed via <LoggerManager>.log(message: string, options: ILogOptions).
An example of a log message is: <LoggerManager>.log(<LoggerManager>.info('[' + <LoggerManager>.emphasis('READY') + ']', true) + ' Client is ready!')
Decorator
A decorator should be made that in it's nature, will catch any errors created by the method and log it as well register it (file or sentry.io).
Logging options (ILogOptions)
// These are basically template references for more easily log messagesenumILogType{ERROR='error',// [ERROR] → <Message>DEBUG='debug',// [DEBUG] → <Message>INFO='info',// [INFO] → <Message>WARNING='warning',// [WARNING] → <Message>}interfaceILogOptions{type?: ILogType// The logging template, optionalregister?: boolean// Whether to report to sentry or on a filesilent?: boolean// Only report, don't log to console}
Errors
When an error is caught with the decorator, it should send to sentry.io if it's configured, or, create a directory (if it doesn't exists) inside <ConfigManager>.rootDirectory called .log and then a file akita_neru.error_<time>.log. An example name for the file is: akita_neru.error_2021-06-24.log.
The text was updated successfully, but these errors were encountered:
Assigned you to this @SpaceEEC since you already coded most of it. If there are specifications missing, please do let me know below or in our development channel @ Discord.
A logger manager is to be created following the specifications below, keep in mind that this should be instanced right after the
ConfigManager
since practically everything depends on it.Configuration
Colors
This enumerator should be followed for colors:
If chalk isn't being used, a
bg<Name>
property needs to be added to each one, otherwise, use the same color. Text should generally always be white, but, when emphasis is needed you can use the<LogColor>.EMPHASIS
color.Features
<LoggerManager>.info(message: string, isBackground?: boolean)
.<LoggerManager>.log(message: string, options: ILogOptions)
.<LoggerManager>.log(<LoggerManager>.info('[' + <LoggerManager>.emphasis('READY') + ']', true) + ' Client is ready!')
Logging options (
ILogOptions
)Errors
When an error is caught with the decorator, it should send to sentry.io if it's configured, or, create a directory (if it doesn't exists) inside
<ConfigManager>.rootDirectory
called.log
and then a fileakita_neru.error_<time>.log
. An example name for the file is:akita_neru.error_2021-06-24.log
.The text was updated successfully, but these errors were encountered: