Skip to content
New issue

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

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

Already on GitHub? # to your account

Unable to set log level #947

Closed
yosriady opened this issue Jul 13, 2020 · 4 comments
Closed

Unable to set log level #947

yosriady opened this issue Jul 13, 2020 · 4 comments
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@yosriady
Copy link

Hello, thank you for your work on ethers.js. I'm trying to set the log level on ethers@5.0.5:

import { ethers } from 'ethers'

ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.OFF)

But that does not appear to work. Instead, it outputs:

invalid log level - OFF

What's the right way to set the log level? I've looked at #379, but the API seems to have changed.

@ricmoo ricmoo added the investigate Under investigation and may be a bug. label Jul 13, 2020
@ricmoo
Copy link
Member

ricmoo commented Jul 13, 2020

It looks like I have a case mismatch in the enum compared to the lookup table.

Can you try using the string "off" instead of the enum? I’ll fix this tomorrow.

@yosriady
Copy link
Author

yosriady commented Jul 13, 2020

@ricmoo

Doing this:

ethers.utils.Logger.setLogLevel('off')

Should work in plain JS, since:

// https://github.com/ethers-io/ethers.js/blob/master/packages/logger/lib/index.js#L5
var LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };

Unfortunately, in a Typescript project this raises an error:

Argument of type '"off"' is not assignable to parameter of type 'LogLevel'

@ricmoo ricmoo added bug Verified to be an issue. on-deck This Enhancement or Bug is currently being worked on. and removed investigate Under investigation and may be a bug. labels Jul 20, 2020
ricmoo added a commit that referenced this issue Jul 20, 2020
@ricmoo
Copy link
Member

ricmoo commented Jul 20, 2020

This should be fixed in v5.0.7.

Try it out and let me know if it works for you. :)

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jul 20, 2020
@yosriady
Copy link
Author

@ricmoo It works, thank you!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

2 participants