[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [C++] output til cerr og logfil



On Thu, 19 Aug 2004 16:11:45 +0200, Kristian Nørgaard wrote:

> Jeg har et C++ program som skriver en del til skærmen med cerr << "Bla
> bla .. " << endl;
> 
> Er der en standard måde at fange al denne information, så den også
> skrives til en logfil?
> 
> Eller er vi ude i at jeg skal lave samtlige cerr statements om til en
> makro/funktion, der skriver den samme streng til hhv. cerr og logfil?
> 
Måske du kan bruge denne lille funktion:

void errorlog(char *msg) {
        if (deamon) {
                openlog("webserver", 0, LOG_USER);
                syslog(LOG_ALERT, "%s", msg);
                closelog();
        }
        if (debug)
                fprintf(stderr, "%s\n", msg);
        exit(EXIT_FAILURE);
}

-- 
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
mir <at> datanom <dot> net
http://search.keyserver.net:11371/pks/lookup?op=get&search=0xE501F51C
mir <at> miras <dot> org
http://search.keyserver.net:11371/pks/lookup?op=get&search=0xE3E80917
--------------------------------------------------------------
Write and test a big program in small pieces.
            - The Elements of Programming Style (Kernighan & Plaugher)




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *