# StdioNode.h

    00001 /*****************************************************************************
    00002  * Author:   Valient Gough <vgough@pobox.com>
    00003  *
    00004  *****************************************************************************
    00005  * Copyright (c) 2004, Valient Gough
    00006  *
    00007  * This library is free software; you can distribute it and/or modify it under
    00008  * the terms of the GNU Lesser General Public License (LGPL), as published by
    00009  * the Free Software Foundation; either version 2.1 of the License, or (at your
    00010  * option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful, but WITHOUT
    00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    00014  * FITNESS FOR A PARTICULAR PURPOSE.  See the LGPL in the file COPYING for more
    00015  * details.
    00016  *
    00017  */
    00018
    00019
    00020 #ifndef _StdioNode_incl_
    00021 #define _StdioNode_incl_
    00022
    00023 #include <rlog/common.h>
    00024 #include <rlog/RLogNode.h>
    00025
    00026 namespace rlog
    00027 {
    00028     // documentation in implementation file
    00029     class RLOG_DECL StdioNode : public RLogNode
    00030     {
    00031     public:
    00032         enum StdioFlags
    00033         {
    00034             DefaultOutput  = 0, // use built-in defaults
    00035             OutputColor    = 1, //< output with color if sending to a TTY
    00036             OutputThreadId = 2, //< include the thread id (not on Win32)
    00037             OutputContext  = 4, //< Include filename and line number in output
    00038             OutputChannel  = 8  //< Include channel name in output
    00039         };
    00040
    00041         StdioNode( int fdOut = 2, int flags = (int)DefaultOutput );
    00042         // for backward compatibility
    00043         StdioNode( int fdOut, bool colorize_if_tty );
    00044
    00045         virtual ~StdioNode();
    00046
    00047         void subscribeTo( RLogNode *node );
    00048
    00049     protected:
    00050         virtual void publish( const RLogData &data );
    00051
    00052         bool colorize;
    00053         bool outputThreadId;
    00054         bool outputContext;
    00055         bool outputChannel;
    00056         int fdOut;
    00057
    00058         StdioNode( const StdioNode & );
    00059         StdioNode &operator = ( const StdioNode & );
    00060     };
    00061
    00062 }
    00063
    00064 #endif