ryanisaacg / quicksilver

A simple framework for 2D games on desktop and web
https://ryanisaacg.github.io/quicksilver
Other
782 stars 77 forks source link

Try log #626

Closed paulirotta closed 4 years ago

paulirotta commented 4 years ago

Don't unwrap log initialization, or for WASM use the optional try_ initialization

625

Checks

paulirotta commented 4 years ago

The above PR solved my immediate problem, but the risk of such a simple fix (ignoring error messages) continues to bother me.

Perhaps a better approach is

if !log_enabled!(Error) {
     // Start quicksilver logging..
}

https://docs.rs/log/0.4.8/log/macro.log_enabled.html

Opinions or other suggestions?

ryanisaacg commented 4 years ago

Both functions return SetLoggerError, which is only used when another logger has been initialized. For that reason, I think that swallowing the errors is a good solution.