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

Warn and info log levels have different outputs #716

Closed
petosorus opened this issue Sep 24, 2019 · 4 comments
Closed

Warn and info log levels have different outputs #716

petosorus opened this issue Sep 24, 2019 · 4 comments
Labels
changelog - maintenance PR attached there's a PR open for this issue

Comments

@petosorus
Copy link

🐛 Bug description

Warn level and info levels have different behaviors. Most notably, the warn level has an emoji first, and the log level second.

image

I took a look at the code, warn and error are similar, but info is different.

    pub fn info(&self, message: &str) {
        let info = format!("{}: {}", style("[INFO]").bold().dim(), message,);
        self.message(&info);
    }

    /// Add a warning message.
    pub fn warn(&self, message: &str) {
        let warn = format!(
            "{} {}: {}",
            emoji::WARN,
            style("[WARN]").bold().dim(),
            message
        );
        self.message(&warn);
    }

    /// Add an error message.
    pub fn error(&self, message: &str) {
        let err = format!(
            "{} {}: {}",
            emoji::ERROR,
            style("[ERR]").bold().dim(),
            message
        );
        self.message(&err);
    }

🤔 Expected Behavior

I would expect the log level to always be the first element of the log. I don't mind the emoji, I just find it in the wrong place.

👟 Steps to reproduce

I ran the example from this page https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm

When running wasm-pack build, I see the incriminated logs.

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.8.1
rustc version: 1.37.0

I would be happy to take a stab at doing a PR for this :)

@drager
Copy link
Member

drager commented Oct 2, 2019

Makes sense! Thanks for reporting!

@drager drager added changelog - maintenance PR attached there's a PR open for this issue labels Oct 2, 2019
@ashleygwilliams
Copy link
Member

@drager you marked this as PR attached- did this get solved? let me know!

@drager
Copy link
Member

drager commented Feb 9, 2020

@ashleygwilliams There is a PR that hasn't been merged yet: #723

ashleygwilliams added a commit that referenced this issue Dec 22, 2020
@drager
Copy link
Member

drager commented Jun 29, 2021

Fixed in #723

@drager drager closed this as completed Jun 29, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
changelog - maintenance PR attached there's a PR open for this issue
Projects
None yet
Development

No branches or pull requests

3 participants