Skip to content

Commit 0bb51f6

Browse files
connernilsenmeta-codesync[bot]
authored andcommitted
Add logging when new sourcedb is loaded
Reviewed By: kinto0 Differential Revision: D92773270 fbshipit-source-id: 9c004d541daec54fbd5e91fe318722186e9633b1
1 parent ef9a4e3 commit 0bb51f6

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

crates/pyrefly_build/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#![feature(const_type_name)]
2626
#![feature(if_let_guard)]
2727

28+
use std::fmt::Display;
2829
use std::path::Path;
2930
use std::path::PathBuf;
3031
use std::sync::Arc;
@@ -42,6 +43,7 @@ pub mod source_db;
4243
pub use source_db::SourceDatabase;
4344
use starlark_map::small_map::SmallMap;
4445
mod query;
46+
use tracing::info;
4547
#[cfg(not(target_arch = "wasm32"))]
4648
use which::which;
4749

@@ -92,6 +94,15 @@ impl BuildSystemArgs {
9294
}
9395
}
9496

97+
impl Display for BuildSystemArgs {
98+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
99+
match self {
100+
Self::Buck(args) => write!(f, "Buck({})", args),
101+
Self::Custom(args) => write!(f, "Custom({})", args),
102+
}
103+
}
104+
}
105+
95106
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
96107
#[serde(rename_all = "kebab-case")]
97108
pub struct BuildSystem {
@@ -147,6 +158,12 @@ impl BuildSystem {
147158
return Some(Ok(result.dupe()));
148159
}
149160

161+
info!(
162+
"Loading new build system at {}: {}",
163+
config_root.display(),
164+
&self.args
165+
);
166+
150167
for path in &mut self.search_path_prefix {
151168
*path = config_root.join(&path);
152169
}

crates/pyrefly_build/src/query/buck.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
use std::fmt::Debug;
9+
use std::fmt::Display;
910
use std::path::Path;
1011
use std::path::PathBuf;
1112
use std::process::Command;
@@ -77,6 +78,16 @@ impl BxlArgs {
7778
}
7879
}
7980

81+
impl Display for BxlArgs {
82+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
83+
write!(
84+
f,
85+
"isolation_dir: {:?}, extras: {:?}",
86+
self.isolation_dir, self.extras
87+
)
88+
}
89+
}
90+
8091
#[derive(Debug)]
8192
pub struct BxlQuerier(BxlArgs);
8293

crates/pyrefly_build/src/query/custom.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
use std::fmt::Debug;
9+
use std::fmt::Display;
910
use std::path::Path;
1011
use std::path::PathBuf;
1112
use std::process::Command;
@@ -45,6 +46,16 @@ impl CustomQueryArgs {
4546
}
4647
}
4748

49+
impl Display for CustomQueryArgs {
50+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
51+
write!(
52+
f,
53+
"command: {:?}, repo_root: {:?}",
54+
self.command, self.repo_root
55+
)
56+
}
57+
}
58+
4859
/// A querier allowing for a custom command when querying and constructing source DB.
4960
#[derive(Debug)]
5061
pub struct CustomQuerier(CustomQueryArgs);

test/basic.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ $ echo -e "from typing import reveal_type\nreveal_type(1)" > $TMPDIR/empty.py &&
2020

2121
```scrut {output_stream: stderr}
2222
$ $PYREFLY check $TEST_PY
23+
INFO Loading new build system at * (glob?)
2324
INFO Querying Buck for source DB (glob?)
2425
INFO Source DB build ID: * (glob?)
2526
INFO Finished querying Buck for source DB (glob?)

0 commit comments

Comments
 (0)