Skip to content

[feat] create setup logger#8

Draft
Joel-leal wants to merge 3 commits intomainfrom
joel/setup-logger
Draft

[feat] create setup logger#8
Joel-leal wants to merge 3 commits intomainfrom
joel/setup-logger

Conversation

@Joel-leal
Copy link

@Joel-leal Joel-leal commented Jan 19, 2026

##Descriptiom

A custom logger was implemented to standardize and structure application logs, improving traceability and observability across the system.

##Changes

[feat]: Add log examples with different criticalities.
[feat]: Created setup logger
[feat]: Block console.log

##Preview

Captura de Tela 2026-01-30 às 15 31 37

##Close #5

@Joel-leal Joel-leal marked this pull request as draft January 19, 2026 14:32
@Joel-leal Joel-leal requested a review from frattezi January 30, 2026 18:34
Copy link
Contributor

@frattezi frattezi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just I consider unnecessary the custom log method, also, we want to enforce the correct usage of log levels (info, warn, error, debug) as it semantically makes more sense than all logging being a customLogger


constructor() {
this.findOrCreateUserDirectory(this.uploadsDir);
console.log('uploadsDir', this.uploadsDir);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this using your logger


@Injectable({ scope: Scope.TRANSIENT })
export class AppLogger extends ConsoleLogger {
customLog(message: string, meta?: LogMeta) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a customLog as of now. by extending the ConsoleLogger we already get all normal methods out of the box.


async get(): Promise<User[]> {
return this.prisma.user.findMany();
this.logger.customLog('Listing users', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of customLog, use general log methods like info here

return saved;
} catch (err) {
const message = err instanceof Error ? err.message : 'Unknown error';
this.logger.customLog('Upsert failed', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example here, you want to simply use this.logger.error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup Logger

2 participants