@@ -12,8 +12,6 @@ use fmt;
12
12
use from_str:: from_str;
13
13
use libc:: exit;
14
14
use option:: { Some , None , Option } ;
15
- use rt;
16
- use rt:: util:: dumb_println;
17
15
use rt:: crate_map:: { ModEntry , CrateMap , iter_crate_map, get_crate_map} ;
18
16
use str:: StrSlice ;
19
17
use u32;
@@ -88,16 +86,16 @@ fn parse_logging_spec(spec: ~str) -> ~[LogDirective]{
88
86
log_level = num;
89
87
} ,
90
88
_ => {
91
- dumb_println ( format ! ( "warning: invalid logging spec \
92
- '{}', ignoring it", parts[ 1 ] ) ) ;
93
- continue ;
89
+ rterrln ! ( "warning: invalid logging spec '{}', \
90
+ ignoring it", parts[ 1 ] ) ;
91
+ continue
94
92
}
95
93
}
96
94
} ,
97
95
_ => {
98
- dumb_println ( format ! ( "warning: invalid logging spec '{}',\
99
- ignoring it", s) ) ;
100
- continue ;
96
+ rterrln ! ( "warning: invalid logging spec '{}', \
97
+ ignoring it", s) ;
98
+ continue
101
99
}
102
100
}
103
101
let dir = LogDirective { name : name, level : log_level} ;
@@ -141,9 +139,9 @@ fn update_log_settings(crate_map: &CrateMap, settings: ~str) {
141
139
let mut dirs = ~[ ] ;
142
140
if settings. len ( ) > 0 {
143
141
if settings == ~":: help" || settings == ~"?" {
144
- dumb_println ( "\n Crate log map:\n " ) ;
142
+ rterrln ! ( "\n Crate log map:\n " ) ;
145
143
do iter_crate_map ( crate_map) |entry| {
146
- dumb_println ( " " + entry. name ) ;
144
+ rterrln ! ( " {}" , entry. name) ;
147
145
}
148
146
unsafe { exit ( 1 ) ; }
149
147
}
@@ -157,12 +155,10 @@ fn update_log_settings(crate_map: &CrateMap, settings: ~str) {
157
155
}
158
156
159
157
if n_matches < ( dirs. len ( ) as u32 ) {
160
- dumb_println ( format ! ( "warning: got {} RUST_LOG specs but only matched\n \
161
- {} of them. You may have mistyped a RUST_LOG \
162
- spec. \n \
163
- Use RUST_LOG=::help to see the list of crates \
164
- and modules.\n ",
165
- dirs. len( ) , n_matches) ) ;
158
+ rterrln ! ( "warning: got {} RUST_LOG specs but only matched\n \
159
+ {} of them. You may have mistyped a RUST_LOG spec. \n \
160
+ Use RUST_LOG=::help to see the list of crates and modules.\n ",
161
+ dirs. len( ) , n_matches) ;
166
162
}
167
163
}
168
164
@@ -174,24 +170,13 @@ pub struct StdErrLogger;
174
170
175
171
impl Logger for StdErrLogger {
176
172
fn log ( & mut self , args : & fmt:: Arguments ) {
177
- fmt:: writeln ( self as & mut rt:: io:: Writer , args) ;
173
+ // FIXME(#6846): this should not call the blocking version of println,
174
+ // or at least the default loggers for tasks shouldn't do
175
+ // that
176
+ :: rt:: util:: dumb_println ( args) ;
178
177
}
179
178
}
180
179
181
- impl rt:: io:: Writer for StdErrLogger {
182
- fn write ( & mut self , buf : & [ u8 ] ) {
183
- // Nothing like swapping between I/O implementations! In theory this
184
- // could use the libuv bindings for writing to file descriptors, but
185
- // that may not necessarily be desirable because logging should work
186
- // outside of the uv loop. (modify with caution)
187
- use io:: Writer ;
188
- let dbg = :: libc:: STDERR_FILENO as :: io:: fd_t ;
189
- dbg. write ( buf) ;
190
- }
191
-
192
- fn flush ( & mut self ) { }
193
- }
194
-
195
180
/// Configure logging by traversing the crate map and setting the
196
181
/// per-module global logging flags based on the logging spec
197
182
pub fn init ( ) {
@@ -212,7 +197,7 @@ pub fn init() {
212
197
_ => {
213
198
match log_spec {
214
199
Some ( _) => {
215
- dumb_println ( "warning: RUST_LOG set, but no crate map found." ) ;
200
+ rterrln ! ( "warning: RUST_LOG set, but no crate map found." ) ;
216
201
} ,
217
202
None => { }
218
203
}
0 commit comments