Am 01.08.2011 23:52 schrieb Stefan Tauner:
in the first step carldani wants to introduce a verbosity level between debug and spew. the attached patch adds such a thing.
Thanks!
i argued that using a consistent naming scheme that indicates verbosity with a number after the printing type instead of "info", "err", "dbg", "spew" etc. would be better. for example msg_p2 (programmer messages at verbosity level 2) or msg_g3 (general messages at verbosity level 3). this was vetoed (for now at least ;).
I vetoed it for two main reasons: - Named message levels convey a meaning which should make it clear to developers if a message has the right level. - Named message levels are present in the Linux kernel and coreboot.
instead of the multiple -V parameters we could add a number after the first V (e.g. -V2 for verbosity level 2). this way we could also include a silent mode more easily without a new character for the parameter. there are no concrete plans for this though (afaik :). my plan was to use the same numbers here and in the code to indicate the level and to make -V0 the silent mode where only errors are reported (or even nothing, and -V1 the error only mode..).
That would disallow command lines lke the one below: # flashrom -Vw foo.bin Messing with optarg stuff can be fun, but I'm not sure the pain is worth it. That said, the idea in general seems to be good, I just don't see a clean way to implement it.
later the library code should support different verbosity levels for different types (e.g. verbosity 1 for generic messages, but verbosity 3 for programmer messages). this does not need to be instantly available for cli users though.
Changing the msg_* macros to provide print() with a new type parameter which can be ignored by cli_output.c would allow other frontends to implement that functionality as needed.
i probably forgot some things that have been discussed (and that's a reason why i wrote the above so that at least that's not lost somewhere in my head :).
we would like to hear any input of other devs regarding this of course!
I like that patch.
Subject: [PATCH] introduce msg_*dbg2
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at
If it compiles, it is Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Regards, Carl-Daniel