Skip to content

crate name in log map is taken from name of output binary, not the crate name #3346

Closed
@jesse99

Description

@jesse99

I can only get error level logging using the project below, I've tried a bunch of versions of RUST_LOG that I think should work and none do (which is complicated by the fact that rustc --ls is still broken). I've tried:

RUST_LOG=logging2::crate::logging2=3
RUST_LOG=::logging2=3
RUST_LOG=3

and more.

Makefile:

RUSTC ?= rustc

dummy1 := $(shell mkdir bin 2> /dev/null)

check:
    $(RUSTC) -o bin/test-logging2 --test crate.rc
    export RUST_LOG=logging2::crate::logging2=3 && ./bin/test-logging2

clean:
    rm -rf bin

crate.rc:

use std;

#[link(name = "logging2",
       vers = "0.1",
       uuid = "91E62841-B9F3-4721-97C6-621BEEE2DA1B")]

mod logging2;

logging2.rs:


#[test]
fn test_logging()
{
    error!("error level");
    warn!("warn level");
    info!("info level");
}

This was with a rustc from master on Sep 1, 2012. Note that I was able to get logging working when compiling a stand-alone rs file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions