DaveWoodCom / XCGLogger

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.
MIT License
3.94k stars 477 forks source link

How Can I color with font #320

Closed wfs498121294 closed 2 years ago

wfs498121294 commented 2 years ago

Hello ,

I use ANSIColorLogFormatter, but it not work let ansiColorLogFormatter = ANSIColorLogFormatter() ansiColorLogFormatter.resetFormatting() log.formatters = [ansiColorLogFormatter]

so I find ColoredConsole can color logger , but I do not have idea work with XXGLogger . can you help me

I use it as this

logger.debug("debug".debugColor()) logger.info("info".infoColor())

I do not know how to cofigure it

DaveWoodCom commented 2 years ago

Xcode no longer supports ANSI colour in the console so ANSIColorLogFormatter isn't useful there anymore. It can be used if you're outputting your logs to a file and then watching that file in a terminal that does support ANSI colours.

The ColoredConsole project uses a custom font to display colour. I don't see why you couldn't create a custom LogFormatter that then uses ColoredConsole to colourize the text.