Thread overview | ||||||
---|---|---|---|---|---|---|
|
April 18, 2008 Log message prefix | ||||
---|---|---|---|---|
| ||||
I'm not to "happy" with with the standard prefix format of the log message, and so I wonder what would be the best approach to customize it. Typically I'm after something along the lines of Timestamp, threadid, severity name - message itself In addition to the above trace info (file and/or function name) may be relevant, possibly depending on severity. The severity names themselves will be defined in the application. Lars Ivar |
April 20, 2008 Re: Log message prefix | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | > I'm not to "happy" with with the standard prefix format of the log message, and so I wonder what would be the best approach to customize it. > > Typically I'm after something along the lines of > > Timestamp, threadid, severity name - message itself First, the "official" way of doing it is only the way adopted by the stock back-ends. It's important to note that Pantheios is designed as a logging API, and the user is intended (and encouraged) to implement their own back-end, which could/would prepare the output statement formats in whatever way they deemed fit. The stock back-ends (and the de-facto standard formatting) is just there as a convenience to users, not in any way any officially prescribed or recommended way. In some of the commercial customisations of front-/back-end systems that I've done the clients have had a variety of different requirements - some including all the fields you list - all of which are reasonably easily achieved. > In addition to the above trace info (file and/or function name) may be relevant, possibly depending on severity. This can be achieved by using the Trace API for the ones you want file+line for, e.g. perhaps DEBUG, INFO and NOTICE. To get __FUNCTION__ in, you can override (via the pre-processor). Check out the examples/cpp/example.cpp.tracing.with_function/example.cpp.tracing.with_func tion.cpp example. > The severity names themselves will be defined in the application. This is quite a bit more invasive. One client's had me do this for them, but it involved a degree of effort, as it was not something anticipated in the original Pantheios design (which assumes known-at-compile-time severity names in order to have absolute maximum name processing efficiency). HTH Matt |
April 20, 2008 Re: Log message prefix | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | Matthew Wilson wrote: >> I'm not to "happy" with with the standard prefix format of the log > message, and so I wonder what would be the best approach to customize it. >> >> Typically I'm after something along the lines of >> >> Timestamp, threadid, severity name - message itself > > First, the "official" way of doing it is only the way adopted by the stock back-ends. > > It's important to note that Pantheios is designed as a logging API, and the user is intended (and encouraged) to implement their own back-end, which could/would prepare the output statement formats in whatever way they deemed fit. The stock back-ends (and the de-facto standard formatting) is just there as a convenience to users, not in any way any officially prescribed or recommended way. > > In some of the commercial customisations of front-/back-end systems that I've done the clients have had a variety of different requirements - some including all the fields you list - all of which are reasonably easily achieved. Yes, I'm already on to this. > >> In addition to the above trace info (file and/or function name) may be > relevant, possibly depending on severity. > > This can be achieved by using the Trace API for the ones you want file+line for, e.g. perhaps DEBUG, INFO and NOTICE. > > To get __FUNCTION__ in, you can override (via the pre-processor). Check > out the > examples/cpp/example.cpp.tracing.with_function/example.cpp.tracing.with_func > tion.cpp example. Yup. > >> The severity names themselves will be defined in the application. > > This is quite a bit more invasive. One client's had me do this for them, but it involved a degree of effort, as it was not something anticipated in the original Pantheios design (which assumes known-at-compile-time severity names in order to have absolute maximum name processing efficiency). Not sure I understand you fully here - the names will be known at compile time. They will just not be exactly the same as the predefined ones (DEBUG, INFO, etc) - but rather augmentations of those like INFO_1, INFO_2, etc -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango |
April 26, 2008 Re: Log message prefix | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | > >> The severity names themselves will be defined in the application.
> >
> > This is quite a bit more invasive. One client's had me do this for them, but it involved a degree of effort, as it was not something anticipated in the original Pantheios design (which assumes known-at-compile-time severity names in order to have absolute maximum name processing efficiency).
>
> Not sure I understand you fully here - the names will be known at compile time. They will just not be exactly the same as the predefined ones (DEBUG, INFO, etc) - but rather augmentations of those like INFO_1, INFO_2, etc
Still not sure what you mean.
Can you enumerate the full list of desired severity levels and, if possible, indicate their equivalents in the stock (Syslog-based)
eight levels.
Cheers
Matt
|
Copyright © 1999-2021 by the D Language Foundation