@@ -12,10 +12,10 @@ Log levels less than `min_level` are filtered out.
1212Message formatting can be controlled by setting keyword arguments: 
1313
1414* `meta_formatter` is a function which takes the log event metadata 
15-   `(level, _module, group, id, file, line)` and returns a face name (used in  
16-   the constructed [`AnnotatedString`](@ref Base.AnnotatedString)) , prefix and 
17-   suffix for the log message.  The  default is to prefix with the log level and 
18-   a suffix containing the module,  file and line location. 
15+   `(level, _module, group, id, file, line)` and returns a color (as would be  
16+   passed to printstyled) , prefix and suffix for the log message.  The  
17+   default is to prefix with the log level and a suffix containing the module,  
18+   file and line location. 
1919* `show_limited` limits the printing of large data structures to something 
2020  which can fit on the screen by setting the `:limit` `IOContext` key during 
2121  formatting. 
5858showvalue (io, ex:: Exception ) =  showerror (io, ex)
5959
6060function  default_logcolor (level:: LogLevel )
61-     level <  Info  ?  :log_debug  : 
62-     level <  Warn  ?  :log_info   : 
63-     level <  Error ?  :log_warn   : 
64-                     :log_error 
61+     level <  Info  ?  Base . debug_color ()  : 
62+     level <  Warn  ?  Base . info_color ()   : 
63+     level <  Error ?  Base . warn_color ()   : 
64+                     Base . error_color () 
6565end 
6666
6767function  default_metafmt (level:: LogLevel , _module, group, id, file, line)
@@ -103,8 +103,6 @@ function termlength(str)
103103    return  N
104104end 
105105
106- termlength (str:: Base.AnnotatedString ) =  textwidth (str)
107- 
108106function  handle_message (logger:: ConsoleLogger , level:: LogLevel , message, _module, group, id,
109107                        filepath, line; kwargs... )
110108    @nospecialize 
@@ -156,10 +154,6 @@ function handle_message(logger::ConsoleLogger, level::LogLevel, message, _module
156154    #  Format lines as text with appropriate indentation and with a box
157155    #  decoration on the left.
158156    color, prefix, suffix =  logger. meta_formatter (level, _module, group, id, filepath, line):: Tuple{Union{Symbol,Int},String,String} 
159-     lcolor =  StyledStrings. Legacy. legacy_color (color)
160-     if  ! isnothing (lcolor)
161-         color =  StyledStrings. Face (foreground= lcolor)
162-     end 
163157    minsuffixpad =  2 
164158    buf =  IOBuffer ()
165159    iob =  IOContext (buf, stream)
@@ -173,19 +167,19 @@ function handle_message(logger::ConsoleLogger, level::LogLevel, message, _module
173167        nonpadwidth =  2  +  length (suffix)
174168    end 
175169    for  (i, (indent, msg)) in  enumerate (msglines)
176-         boxstr =  length (msglines) ==  1  ?  " ["   : 
177-                  i ==  1                 ?  " ┌"   : 
178-                  i <  length (msglines)  ?  " │"   : 
179-                                          " └" 
180-         print (iob, styled " {$color, bold:$boxstr}  "  )
170+         boxstr =  length (msglines) ==  1  ?  " [  "   : 
171+                  i ==  1                 ?  " ┌  "   : 
172+                  i <  length (msglines)  ?  " │  "   : 
173+                                          " └  " 
174+         printstyled (iob, boxstr,  bold= true , color = color )
181175        if  i ==  1  &&  ! isempty (prefix)
182-             print (iob, styled " {$color, bold:$prefix}  "  )
176+             printstyled (iob, prefix,  "   " ,  bold= true , color = color )
183177        end 
184178        print (iob, "  " ^ indent, msg)
185179        if  i ==  length (msglines) &&  ! isempty (suffix)
186180            npad =  max (0 , justify_width -  nonpadwidth) +  minsuffixpad
187181            print (iob, "  " ^ npad)
188-             print (iob, styled " {shadow:$ suffix} "  )
182+             printstyled (iob, suffix, color = :light_black )
189183        end 
190184        println (iob)
191185    end 
0 commit comments