Skip to content

Initalize log from string #440

@Dragon-GCS

Description

@Dragon-GCS

Now log4rs can init log config from a file, but this means that the config file should be placed togother with the binary file.

like that

src/
├── log.rs
├── main.rs
└── config.toml

I can run cargo run with init::file("src/config.toml"), but after compiled, init::file can't find the config file on src/config.toml

I want to complile the config into the binary, maybe like that:

let config_string = include_str!("src/config.toml")
log4rs::init_string(config_string, Format::Toml)
// or a macro
log4rs::init_string!("src/config.toml")

Or maybe there are a better way to run a binary file without a config file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions