forked from AlariCode/nestjs-rmq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AlariCode#8 from AlariCode/master
Sync with Master
- Loading branch information
Showing
15 changed files
with
487 additions
and
255 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
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,30 @@ | ||
import { Logger, LoggerService } from '@nestjs/common'; | ||
import { blueBright, white, yellow } from 'chalk'; | ||
|
||
export class RQMColorLogger implements LoggerService { | ||
logMessages: boolean; | ||
|
||
constructor(logMessages: boolean) { | ||
this.logMessages = logMessages ?? false; | ||
} | ||
log(message: any, context?: string): any { | ||
Logger.log(message, context); | ||
} | ||
error(message: any, trace?: string, context?: string): any { | ||
Logger.error(message, trace, context); | ||
} | ||
debug(message: any, context?: string): any { | ||
if(!this.logMessages) { | ||
return; | ||
} | ||
const split = new RegExp(/(.*?)(\[.*?])(.*)/g).exec(message); | ||
if(split[3]) { | ||
Logger.log(`${blueBright(split[1])} ${yellow(split[2])} ${white(split[3])}`); | ||
} else { | ||
Logger.log(message, context); | ||
} | ||
} | ||
warn(message: any, context?: string): any { | ||
Logger.warn(message, context); | ||
} | ||
} |
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
Oops, something went wrong.