Am 29.08.2013 09:14, schrieb ArtemGr:
> Tommi Mäkitalo <tommi@...> writes:
>> As I said it is very difficult to specify all the options from the
>> command line. The command line will get very complicated. Not to say
>> unusable.
> That's not true, there are programs which can be configured almost entirely
> from the command line, MySQL and Unison File Synchronizer for example,
> they have configuration files but any option in the config is also a
> command-line option. It is both usable *and* convenient.
> For logging there can be
> --logging-rootlogger=$level
> --logging-logger=$category:$level
> --logging-file=$path
> --logging-maxfilesize=$size
> options, they are simple to understand and implement.
>
> Not that I would prever that method, I would actually like to configure
> the logging using a well-defined C++ API. I configure the Tntnet
> entirely from the code, using the API, but for logging I has to keep
> an XML file.
Hi,
I've thought about that and I may have an idea, how to make all happy.
There is already a configuration class, which has a deserialization
operator. The problem is, that it is just internally used. I have to do
some refactorization and make the configuration class public. Then one
can either read the class using a deserializer or fill it manually. It
will then look like this:
cxxtools::LogConfiguration logConfiguration;
logConfiguration.setRootLogger(INFO);
logConfiguration.setCategory("foo.bar", DEBUG);
logConfiguration.setFile("output.log");
log_init(logConfiguration);
Of course the current interface will be kept, so nothing will change for
those, who use cxxtools logging already.
But the plan is not to stop here. I talked with a colleague of me and we
decided, that it would be great, if the configuration could be changed
at runtime. One can offer some interface (say rpc call or similar) to
change the configuration without restart. This will need some more
rethinking, but I feel, that it would be worth.
Tommi
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general