At this very moment, I don't understand the difference of logging something with the UtilService or LoggerService.
Suggestion
The LoggerService gets enhanced with being able to:
- Set a prefix
- Debug Level (0, 1, 2, 3)
- Log only in Development and/or Production
- Log to a file in certain directory
Example
enum ImportanceEnum {
Info = 0,
Warning = 1,
Error = 2,
CriticalError = 3
}
setup(logToFile: Path, logInProduction: boolean = false): void
log(prefix: string, text: string, level: ImportanceEnum): void
// Setup must be called first
this.loggerService.setup("./logs", false);
this.loggerService.log("[Vehicle Module]","Vehicle doesn't exist", ImportanceEnum.CriticalError);
// Which would generate the following
// Root Dir -> logs/15.06.2021
// (15.06.2021 14:01) [CriticalError] [Vehicle Module]: Vehicle doesn't exist
Final Words
This is a rough idea, feel free to discuss
At this very moment, I don't understand the difference of logging something with the UtilService or LoggerService.
Suggestion
The LoggerService gets enhanced with being able to:
Example
Final Words
This is a rough idea, feel free to discuss