Skip to content

Commit

Permalink
Update sccache-dist to use SCCACHE_LOG. (mozilla#977)
Browse files Browse the repository at this point in the history
* Update sccache-dist to use SCCACHE_LOG.

This fixes mozilla#969 which was overlooked when fixing mozilla#810.

* Update sccache-dist docs and tests.

This replaces usage of `RUST_LOG` with `SCCACHE_LOG` in the docs and
the tests.

* Fix up missed conflict markers...
  • Loading branch information
rthomas authored Jun 24, 2022
1 parent 1361839 commit 02bcd40
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/DistributedQuickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Start the scheduler by running:
sccache-dist scheduler --config scheduler.conf
```

Like the local server, the scheduler process will daemonize itself unless `SCCACHE_NO_DAEMON=1` is set. If the scheduler fails to start you may need to set `RUST_LOG=trace` when starting it to get useful diagnostics.
Like the local server, the scheduler process will daemonize itself unless `SCCACHE_NO_DAEMON=1` is set. If the scheduler fails to start you may need to set `SCCACHE_LOG=trace` when starting it to get useful diagnostics.

Configure a build server
------------------------
Expand Down Expand Up @@ -98,7 +98,7 @@ Due to bubblewrap requirements currently the build server *must* be run as root.
sudo sccache-dist server --config server.conf
```

As with the scheduler, if the build server fails to start you may need to set `RUST_LOG=trace` to get useful diagnostics.
As with the scheduler, if the build server fails to start you may need to set `SCCACHE_LOG=trace` to get useful diagnostics.

Configure a client
------------------
Expand Down
4 changes: 2 additions & 2 deletions src/bin/sccache-dist/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ fn run(command: Command) -> Result<i32> {
}

fn init_logging() {
if env::var("RUST_LOG").is_ok() {
match env_logger::try_init() {
if env::var(sccache::LOGGING_ENV).is_ok() {
match env_logger::Builder::from_env(sccache::LOGGING_ENV).try_init() {
Ok(_) => (),
Err(e) => panic!("Failed to initalize logging: {:?}", e),
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ pub mod util;

use std::env;

const LOGGING_ENV: &str = "SCCACHE_LOG";
/// Used to denote the environment variable that controls
/// logging for sccache, and sccache-dist.
pub const LOGGING_ENV: &str = "SCCACHE_LOG";

pub fn main() {
init_logging();
Expand Down
2 changes: 1 addition & 1 deletion tests/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod harness;
fn basic_compile(tmpdir: &Path, sccache_cfg_path: &Path, sccache_cached_cfg_path: &Path) {
let envs: Vec<(_, &OsStr)> = vec![
("RUST_BACKTRACE", "1".as_ref()),
("RUST_LOG", "sccache=trace".as_ref()),
("SCCACHE_LOG", "sccache=trace".as_ref()),
("SCCACHE_CONF", sccache_cfg_path.as_ref()),
("SCCACHE_CACHED_CONF", sccache_cached_cfg_path.as_ref()),
];
Expand Down
6 changes: 3 additions & 3 deletions tests/harness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl DistSystem {
"-e",
"SCCACHE_NO_DAEMON=1",
"-e",
"RUST_LOG=sccache=trace",
"SCCACHE_LOG=sccache=trace",
"-e",
"RUST_BACKTRACE=1",
"-v",
Expand Down Expand Up @@ -332,7 +332,7 @@ impl DistSystem {
"--name",
&server_name,
"-e",
"RUST_LOG=sccache=trace",
"SCCACHE_LOG=sccache=trace",
"-e",
"RUST_BACKTRACE=1",
"-v",
Expand Down Expand Up @@ -400,7 +400,7 @@ impl DistSystem {
child
}
ForkResult::Child => {
env::set_var("RUST_LOG", "sccache=trace");
env::set_var("SCCACHE_LOG", "sccache=trace");
env_logger::try_init().unwrap();
void::unreachable(server.start().unwrap())
}
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ fn test_auth_with_config(dist_auth: sccache::config::DistAuth) {
.unwrap();
let sccache_cached_config_path = conf_dir.path().join("sccache-cached-config");
let envs = vec![
("RUST_LOG", "sccache=trace".into()),
("SCCACHE_LOG", "sccache=trace".into()),
("SCCACHE_CONF", sccache_config_path.into_os_string()),
(
"SCCACHE_CACHED_CONF",
Expand Down

0 comments on commit 02bcd40

Please sign in to comment.