OW_CerrAppender.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2004 Vintela, Inc. All rights reserved.
00003 *
00004 * Redistribution and use in source and binary forms, with or without
00005 * modification, are permitted provided that the following conditions are met:
00006 *
00007 *  - Redistributions of source code must retain the above copyright notice,
00008 *    this list of conditions and the following disclaimer.
00009 *
00010 *  - Redistributions in binary form must reproduce the above copyright notice,
00011 *    this list of conditions and the following disclaimer in the documentation
00012 *    and/or other materials provided with the distribution.
00013 *
00014 *  - Neither the name of Vintela, Inc. nor the names of its
00015 *    contributors may be used to endorse or promote products derived from this
00016 *    software without specific prior written permission.
00017 *
00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 * POSSIBILITY OF SUCH DAMAGE.
00029 *******************************************************************************/
00030 
00035 #include "OW_config.h"
00036 #include "OW_CerrAppender.hpp"
00037 #include "OW_String.hpp"
00038 #include "OW_Mutex.hpp"
00039 #include "OW_MutexLock.hpp"
00040 
00041 #include <iostream>
00042 
00043 namespace OW_NAMESPACE
00044 {
00045 
00047 CerrAppender::CerrAppender(const StringArray& components,
00048    const StringArray& categories,
00049    const String& pattern)
00050    : LogAppender(components, categories, pattern)
00051 {
00052 }
00053 
00055 CerrAppender::~CerrAppender()
00056 {
00057 }
00058 
00060 namespace
00061 {
00062    Mutex cerrGuard;
00063 }
00064 
00065 void
00066 CerrAppender::doProcessLogMessage(const String& formattedMessage, const LogMessage& message) const
00067 {
00068    MutexLock lock(cerrGuard);
00069    std::clog << formattedMessage << std::endl;
00070 }
00071 
00073 // const char* red = "\x1b[1;31;40m";
00074 // const char* darkRed = "\x1b[0;31;40m";
00075 // const char* green = "\x1b[1;32;40m";
00076 // const char* darkGreen = "\x1b[0;32;40m";
00077 // const char* yellow = "\x1b[1;33;40m";
00078 // const char* darkYellow = "\x1b[0;33;40m";
00079 // const char* blue = "\x1b[1;34;40m";
00080 // const char* darkBlue = "\x1b[0;34;40m";
00081 // const char* purple = "\x1b[1;35;40m";
00082 // const char* darkPurple = "\x1b[0;35;40m";
00083 // const char* cyan = "\x1b[1;36;40m";
00084 // const char* darkCyan = "\x1b[0;36;40m";
00085 // const char* white = "\x1b[1;37;40m";
00086 // const char* darkWhite = "\x1b[0;37;40m";
00087 // const char* gray = "\x1b[0;37;40m";
00088 // const char* resetColor = "\x1b[0;37;40m";
00089 
00090 // colorized version: const String CerrAppender::STR_DEFAULT_MESSAGE_PATTERN("\x1b[1;37;40m[\x1b[1;31;40m%-.6t\x1b[1;37;40m]\x1b[1;32;40m %m\x1b[0;37;40m");
00091 const String CerrAppender::STR_DEFAULT_MESSAGE_PATTERN("[%-.6t] %m");
00092 
00093 
00094 } // end namespace OW_NAMESPACE
00095 
00096 
00097 

Generated on Thu Feb 9 08:47:52 2006 for openwbem by  doxygen 1.4.6