File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,15 @@ impl log::Log for KernelLogger {
5353 let level = ColorLevel ( record. level ( ) ) ;
5454 // FIXME: Use `super let` once stable
5555 let target = record. target ( ) ;
56+ let ( crate_, modules) = target. split_once ( "::" ) . unwrap_or ( ( target, "" ) ) ;
57+ let ( _modules, module) = modules. rsplit_once ( "::" ) . unwrap_or ( ( "" , modules) ) ;
58+ let target = if !module. is_empty ( ) && crate_ == "hermit" {
59+ module
60+ } else {
61+ crate_
62+ } ;
5663 let format_target = if cfg ! ( feature = "log-target" ) {
57- format_args ! ( " {target}" )
64+ format_args ! ( " {target:<10 }" )
5865 } else {
5966 format_args ! ( "" )
6067 } ;
@@ -80,7 +87,7 @@ impl fmt::Display for ColorLevel {
8087 let level = self . 0 ;
8188
8289 if no_color ( ) {
83- write ! ( f, "{level}" )
90+ write ! ( f, "{level:<5 }" )
8491 } else {
8592 let color = match level {
8693 Level :: Trace => AnsiColor :: Magenta ,
@@ -91,7 +98,7 @@ impl fmt::Display for ColorLevel {
9198 } ;
9299
93100 let style = anstyle:: Style :: new ( ) . fg_color ( Some ( color. into ( ) ) ) ;
94- write ! ( f, "{style}{level}{style:#}" )
101+ write ! ( f, "{style}{level:<5 }{style:#}" )
95102 }
96103 }
97104}
You can’t perform that action at this time.
0 commit comments