-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(logger): Add log level configuration (#1451) #4068
Conversation
Is there anything I could do to help this PR to be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add entries to the
allowedNames and describes sections of cli.ts
.
Otherwise this looks good
lib/logger.ts
Outdated
@@ -54,6 +54,8 @@ export class Logger { | |||
static set(config: Config): void { | |||
if (config.troubleshoot) { | |||
Logger.logLevel = LogLevel.DEBUG; | |||
} else if (config.logLevel) { | |||
Logger.logLevel = (<any>LogLevel)[config.logLevel]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is (<any>LogLevel)
accomplishing here? I'm able to compile without it (that said, I'm not a typescript expert, so perhaps I am missing something).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NVM this is an error in [email protected]
but not 2.0.10
(which we have pinned)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you figured out but it is used to convert string to enum, found on SO.
Would you prefer a comment to make it easier to read or just remove it for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i'm okay leaving it as is; unless others have strong opinions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might try something like this for log levels :
let logLevel: 'ERROR'|'WARN'|'INFO'|'DEBUG'
logLevel = 'OLOLO' //compilation error here
001158e
to
f3e2928
Compare
I have updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was playing around with the typing for LogLevel a little more (using TS 2.1) and I think i've found a simplified version that has the benefit of explicitly stating the values for
|
dc08766
to
576c2f5
Compare
I have updated the PR with @NickTomlin and @Xotabu4 suggestions |
How are we on this PR? |
@seanmay mind taking a look at this when you have some free time? |
can we merge this PR? It is a useful feature! |
Could you please add a test for this change? |
We would also really like to see this merged. |
@bcaudan If you get time can you please add some tests? This PR is pending from long time! |
I've been using this hacky solution for now. Also, I would be open to writing tests for this PR (or opening another with tests) if that would be okay with @bcaudan. |
Sorry for the long delay. |
576c2f5
to
50b5e26
Compare
50b5e26
to
3a61497
Compare
@qiyigg I have added some unit tests for the circle ci tests exited with:
is it a known error? can you trigger a rebuild? |
@bcaudan I already triggered a rebuild, let's see what happens. |
@qiyigg Will there be a new release soon with these changes? |
@alecmerdler to be honest, I don't have enough bandwidth recently, I'll try to make it this week, but no guarantee. |
No description provided.