File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
crates/rust-analyzer/src/bin Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 50
50
-q, --quiet Set verbosity
51
51
52
52
--log-file <PATH> Log to the specified file instead of stderr
53
- --no-buffering Flush log records to the file immediately
53
+ --no-log-buffering
54
+ Flush log records to the file immediately
54
55
55
56
--wait-dbg Wait until a debugger is attached to.
56
57
The flag is valid for debug builds only
@@ -139,7 +140,7 @@ impl Args {
139
140
( false , true , true ) => bail ! ( "Invalid flags: -q conflicts with -v" ) ,
140
141
} ;
141
142
let log_file = matches. opt_value_from_str ( "--log-file" ) ?;
142
- let no_buffering = matches. contains ( "--no-buffering" ) ;
143
+ let no_buffering = matches. contains ( "--no-log- buffering" ) ;
143
144
let wait_dbg = matches. contains ( "--wait-dbg" ) ;
144
145
145
146
if matches. contains ( [ "-h" , "--help" ] ) {
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ impl Log for Logger {
47
47
if !self . filter . matches ( record) {
48
48
return ;
49
49
}
50
- match & self . file {
50
+
51
+ let should_flush = match & self . file {
51
52
Some ( w) => {
52
53
let _ = writeln ! (
53
54
w. lock( ) ,
@@ -56,16 +57,20 @@ impl Log for Logger {
56
57
record. module_path( ) . unwrap_or_default( ) ,
57
58
record. args( ) ,
58
59
) ;
60
+ self . no_buffering
59
61
}
60
- None => eprintln ! (
61
- "[{} {}] {}" ,
62
- record. level( ) ,
63
- record. module_path( ) . unwrap_or_default( ) ,
64
- record. args( ) ,
65
- ) ,
66
- }
62
+ None => {
63
+ eprintln ! (
64
+ "[{} {}] {}" ,
65
+ record. level( ) ,
66
+ record. module_path( ) . unwrap_or_default( ) ,
67
+ record. args( ) ,
68
+ ) ;
69
+ true // flush stderr unconditionally
70
+ }
71
+ } ;
67
72
68
- if self . no_buffering {
73
+ if should_flush {
69
74
self . flush ( ) ;
70
75
}
71
76
}
You can’t perform that action at this time.
0 commit comments