Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console.log debug on staging env #922

Open
Anduin2017 opened this issue Oct 3, 2020 · 0 comments
Open

Console.log debug on staging env #922

Anduin2017 opened this issue Oct 3, 2020 · 0 comments
Assignees

Comments

@Anduin2017
Copy link
Member

Anduin2017 commented Oct 3, 2020

What do you suggest us to do?

Since @hv0905 mentioned that console.log is really a nice way for developers to diagnostic issues. I suggest that we can write it more to allow debugging in our staging env.

While when we are doing this approach, I don't suggest to write the following code everywhere:

if (isStaging) {
    console.log('some debug details');
}

But instead, we gonna create a log service.

interface LoggerService {
    log(Logging: any): void; 
}

And implement it with different ways. Like:

class ConsoleLogger : LoggerService {
}

class DummyLogger : LoggerService {
}

And use ConsoleLogger in staging env and DummyLogger in prod env.

if (isStaging) {
    services.Add<ConsoleLogger, LoggerService>();
} else {
    services.Add<DummyLogger, LoggerService>(); // I don't know if Angular dependency injection framework supports that...
}
@Anduin2017 Anduin2017 changed the title Console.log debug Console.log debug on staging env Oct 4, 2020
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

No branches or pull requests

2 participants