0b01•

I use ferns function logger pass in a closure that calls stdweb's console!(log, ) macro so I can use info!, debug! as usual.

6
iamcodemakerOP•

Interesting approach. I wasn't aware of fern. I'll add a link to this in the readme in case users want more flexibility. Maybe I should export a log() function that can be passed directly to fern. 🤔

Edit: implemented in v0.1.2

5
anlumo•

What does it do that does add 180kB to the binary? There are whole operating systems that have less than that.

3
slipthay•

You would have to do a full audit of the log crate to be sure. But from experience Rust's format!/format_args! macros bloat WASM binaries pretty badly. In general it's clear that binary size has been a low priority somewhere in the dev chain here.

7
iamcodemakerOP•

Yes, adding the formatting code adds a bunch of functions and additional bindings that take up a lot of space. I should also note that this was measured in a debug build. No compression or stripping of the binary was done. Building with parcel's defaults (instead of wasm-pack's defaults) results in a size diff of about 40k.

I should also note that it is trivial to build with console_log enabled in debug builds and disable it in releases. All the log statements can stay in place with no size penalty.

3
vi0oss•

Does release_max_level_off Cargo feature of log remove the formatting code?

1
iamcodemakerOP•

No, it does not. It disables logging, but the formatting code appears to stay.

Edit: I believe those features change a static variable that is checked at runtime, so the code is still reachable after compiling.

1