Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: logging and C++

Author: Kirill Kryukov

Date: 21:48:54 01/17/06

Go up one level in this thread


Hi Andy,

On January 17, 2006 at 18:26:40, Andreas Guettinger wrote:

>I search for a good solution to log output to a file.
>
>Certain output of my engine I want to write both to console and to a logfile. In
>C I used a function log(const char* format, ...) toghether with a va_list and
>vprintf() and vfprintf(). Now, in C++ there must be a better way to do this...
>
>I thought of having a ostringstream that composes the output to a string
>(strings, integers etc, whatever is part of the output) and a function to direct
>this string to the console and file. Is this the right way to this? How can I
>put this all into a class that I can include to various source files? Does
>somebody have an example for this?
>
>regards
>Andy

You can try some existing nice libraries before investing time and efforts in
your own routines.

http://log4cplus.sourceforge.net/

http://sourceforge.net/projects/log4cpp/

http://logging.apache.org/log4cxx/

Best,
Kirill





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.