agfline / LibAAF

Library for Advanced Authoring Format (AAF) file reading.
GNU General Public License v2.0
25 stars 5 forks source link

please remove colored output escape sequences #14

Closed x42 closed 9 months ago

x42 commented 9 months ago

*aaf.log files are essentially binary files, hard to read for humans, and do not follow any common log standard.

image

agfline commented 9 months ago

Well, unicode colors where there for human readability of the AAF tree in the first place (distinguishing unsupported AAF class/objects, warnings and errors). Otherwise, this tree is pretty hard to read in plain text, especially with large AAF files. Maybe I should go with some html logging then ? Not very common, but more portable and still readable. What do you think ?

umlaeute commented 9 months ago

typically you would:

i haven't checked the actual use in libaaf (e.g. whether this is a problem of the helper-tools only or of the library itself). you might just want to use an environment variable (LIBAAF_LOG_NO_COLOR=1), and/or some configuration setting (aafi_set_debug() appears to be the place to set this)

umlaeute commented 9 months ago

i think a more practical way would be to use an external colorizer, like grc. the basic idea is to add the color-information based on mangling the logfile with regular expressions. this way you can have logfiles that are free of ANSI control characters (and therefore can be pasted into bug-reports without giving anyone eyesore), and still have colored logfiles to inspect. also, if you your logfiles can be easily parsed with regexes, this is probably a good thing anyhow.

on the downsize, it seems that most colorizers are not really active. e.g. a quick search gives me the following packages (in no particular order)

agfline commented 9 months ago

Ok, made ANSI colors optional by passing one extra argument (ansicolor) to aafi_set_debug()

https://github.com/agfline/LibAAF/blob/ffe038919ed28e99c6eb0b1ca10797b1f03a4552/include/libaaf/AAFIface.h#L922

I've also added a line prefix when printing the AAF object tree : err, wrn and uns (for unsupported object/class)

x42 commented 9 months ago

Maybe I should go with some html logging then ?

going from bad to worse :)

Log-level and log-domain is established for libraries. Provide semantics not format! Let the user application format it.

eg. provide "this is important" , then user app can thane make it bold, or red, or large.