@@ -123,24 +123,54 @@ impl<const FIXED_TIME: bool> Layout for TextLayout<FIXED_TIME> {
123123 PRINTER . print_timestamp_with_offset ( & timestamp, offset, & mut buf) ?;
124124 }
125125
126- write ! (
127- buf,
128- " {:>5} {}: {}:{} {}" ,
129- record. level( ) ,
130- record. module_path( ) . unwrap_or( "" ) ,
131- Path :: new( record. file( ) . unwrap_or_default( ) )
132- . file_name( )
133- . and_then( |name| name. to_str( ) )
134- . unwrap_or_default( ) ,
135- record. line( ) . unwrap_or( 0 ) ,
136- record. args( ) ,
137- ) ?;
126+ let level = record. level ( ) ;
127+ let module = map_module ( record. module_path ( ) . unwrap_or ( "" ) ) ;
128+ let log_file = Path :: new ( record. file ( ) . unwrap_or_default ( ) )
129+ . file_name ( )
130+ . and_then ( |name| name. to_str ( ) )
131+ . unwrap_or_default ( ) ;
132+ let line = record. line ( ) . unwrap_or ( 0 ) ;
133+ let msg = record. args ( ) ;
134+ write ! ( buf, " {level:>5} {module}: {log_file}:{line} {msg}" , ) ?;
138135 record. key_values ( ) . visit ( & mut KvWriter ( & mut buf) ) ?;
139136
140137 Ok ( buf)
141138 }
142139}
143140
141+ fn map_module ( full_name : & str ) -> & str {
142+ if full_name. starts_with ( "databend_query" ) {
143+ if full_name. starts_with ( "databend_query::sessions::query_ctx" ) {
144+ return "[QUERY-CTX]" ;
145+ }
146+ if full_name. starts_with ( "databend_query::sessions::queue_mgr" ) {
147+ return "[QUERY-QUEUE]" ;
148+ }
149+ if full_name. starts_with ( "databend_query::interpreters::interpreter" ) {
150+ return "[INTERPRETER]" ;
151+ }
152+ if full_name. starts_with ( "databend_query::servers::http::v1::query" ) {
153+ return "[HTTP-QUERY]" ;
154+ }
155+ if full_name. starts_with ( "databend_query::pipelines::builders" ) {
156+ return "[BUILD-PIPELINES]" ;
157+ }
158+ if full_name. starts_with ( "databend_query::pipelines::executor::query_pipeline_executor" ) {
159+ return "[PIPELINE-EXECUTOR]" ;
160+ }
161+ if full_name. starts_with ( "databend_query::pipelines::processors::transforms" ) {
162+ return "[TRANSFORMS]" ;
163+ }
164+ }
165+ if full_name. starts_with ( "databend_common_pipeline_transforms" ) {
166+ return "[TRANSFORMS]" ;
167+ }
168+ if full_name. starts_with ( "databend_common_sql::planner::planner" ) {
169+ return "[SQL-PLANNER]" ;
170+ }
171+ full_name
172+ }
173+
144174#[ derive( Debug ) ]
145175pub struct JsonLayout < const FIXED_TIME : bool = false> ;
146176
0 commit comments