Walter Mundt wrote:
Henry Jen wrote:
A couple comments:

1. How do you distinguish the event source? Even in a single application, multiple categories may be desired to classify the events. Not to mention different apps.

There is no facility to do this currently. I deliberately decided to leave that out for several reasons. The most relevant for discussion on this list is that I tried to make the API so that it provides the minimal subset of logging functionality that must be implemented in a platform-dependent way. Since context-aware logging functions could easily be built on top of this API without sacrificing any functionality, I left them out.


AFAIK, Windows event logging API supports Event Source and Unix syslog supports facility and a ident string. So I believe this should be implemented in a Platform-dependent way instead of being part of the message for a platform independent approach.

If there is a consensus among APR developers that more functionality (like this, but really anything useful that fits in the "has an optimal platform-independent implementation" mold) should be included, I have no problem adding it.


These 2 things are really all I needed for a basic logging API.

2. This may only be me, but I would like to have capability to turn off some logging capability at runtime. It's kind of different verbose levels. With that, you can have more verbose logs to help you debugging an application when needed while a minimum when things are running fine.

That's a very common usage scenario, and one that I allow via the level parameters on the log constructors. However, I neglected to add a function for changing the logging level post-construction-time. I'll add a spec for one on the wiki and in any revised app if someone comments through Google.


Sorry for pitching the jxta logging API again. The selector API is for this purpose so that you can choose what to be logged based on both facility and level. Which is basically same thing to the selector in syslog.conf man page.

So add an apr_log_set_selector(apr_log_t *log, const char* str) to your proposal would do it. :-)

Another thing is that, it would be much convenient to allow apr_snprintf style logging. What I am saying is

apr_status_t apr_log_append(const char *cat, int level, const char *fmt, ...);

Another API might be useful is to close an log file early. That is,

apr_status_t apr_log_close(apr_log_t *log);

Cheers,
Henry

Reply via email to