Computer Chess Club Archives


Search

Terms

Messages

Subject: logging and C++

Author: Andreas Guettinger

Date: 15:26:40 01/17/06


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



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.