|
00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: pantheios/util/severity/WindowsEventLog.h 00003 * 00004 * Purpose: Translations from Pantheios stock severity to Windows Event 00005 * Log type. 00006 * 00007 * Created: 13th November 2007 00008 * Updated: 14th February 2010 00009 * 00010 * Home: http://www.pantheios.org/ 00011 * 00012 * Copyright (c) 2007-2010, Matthew Wilson and Synesis Software 00013 * All rights reserved. 00014 * 00015 * Redistribution and use in source and binary forms, with or without 00016 * modification, are permitted provided that the following conditions are 00017 * met: 00018 * 00019 * - Redistributions of source code must retain the above copyright notice, 00020 * this list of conditions and the following disclaimer. 00021 * - Redistributions in binary form must reproduce the above copyright 00022 * notice, this list of conditions and the following disclaimer in the 00023 * documentation and/or other materials provided with the distribution. 00024 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the 00025 * names of any contributors may be used to endorse or promote products 00026 * derived from this software without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00029 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00030 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00031 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00032 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00033 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00034 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00035 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00036 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00037 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00038 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 * 00040 * ////////////////////////////////////////////////////////////////////// */ 00041 00042 00049 #ifndef PANTHEIOS_INCL_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG 00050 #define PANTHEIOS_INCL_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG 00051 00052 /* ///////////////////////////////////////////////////////////////////////// 00053 * Version information 00054 */ 00055 00056 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION 00057 # define PANTHEIOS_VER_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG_MAJOR 1 00058 # define PANTHEIOS_VER_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG_MINOR 2 00059 # define PANTHEIOS_VER_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG_REVISION 2 00060 # define PANTHEIOS_VER_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG_EDIT 15 00061 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ 00062 00063 /* ///////////////////////////////////////////////////////////////////////// 00064 * Includes 00065 */ 00066 00067 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS 00068 # include <pantheios/pantheios.h> 00069 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */ 00070 #ifndef PANTHEIOS_INCL_PANTHEIOS_QUALITY_H_CONTRACT 00071 # include <pantheios/quality/contract.h> 00072 #endif /* !PANTHEIOS_INCL_PANTHEIOS_QUALITY_H_CONTRACT */ 00073 00074 #ifndef WINSTL_INCL_WINSTL_H_WINSTL 00075 # include <winstl/winstl.h> 00076 #endif /* !WINSTL_INCL_WINSTL_H_WINSTL */ 00077 00078 /* ///////////////////////////////////////////////////////////////////////// 00079 * Namespace 00080 */ 00081 00082 #if !defined(PANTHEIOS_NO_NAMESPACE) 00083 namespace pantheios 00084 { 00085 00086 #endif /* !PANTHEIOS_NO_NAMESPACE */ 00087 00088 /* ///////////////////////////////////////////////////////////////////////// 00089 * Functions 00090 */ 00091 00098 #ifdef __cplusplus 00099 inline 00100 #else /* ? __cplusplus */ 00101 static 00102 #endif /* __cplusplus */ 00103 WORD pantheios_severity_to_WindowsEventLog_type(int severity) 00104 { 00105 WORD type; 00106 00107 PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API((severity >= 0 && severity < 16), "invalid severity"); 00108 00109 switch(severity) 00110 { 00111 case PANTHEIOS_SEV_EMERGENCY: type = EVENTLOG_ERROR_TYPE; break; 00112 case PANTHEIOS_SEV_ALERT: type = EVENTLOG_ERROR_TYPE; break; 00113 case PANTHEIOS_SEV_CRITICAL: type = EVENTLOG_ERROR_TYPE; break; 00114 case PANTHEIOS_SEV_ERROR: type = EVENTLOG_ERROR_TYPE; break; 00115 case PANTHEIOS_SEV_WARNING: type = EVENTLOG_WARNING_TYPE; break; 00116 case PANTHEIOS_SEV_NOTICE: type = EVENTLOG_INFORMATION_TYPE; break; 00117 case PANTHEIOS_SEV_INFORMATIONAL: type = EVENTLOG_INFORMATION_TYPE; break; 00118 default: 00119 case PANTHEIOS_SEV_DEBUG: type = EVENTLOG_INFORMATION_TYPE; break; 00120 } 00121 00122 return type; 00123 } 00124 00125 /* ///////////////////////////////////////////////////////////////////////// 00126 * Namespace 00127 */ 00128 00129 #if !defined(PANTHEIOS_NO_NAMESPACE) 00130 } /* namespace pantheios */ 00131 #endif /* !PANTHEIOS_NO_NAMESPACE */ 00132 00133 /* ///////////////////////////////////////////////////////////////////////// 00134 * Inclusion 00135 */ 00136 00137 #ifdef STLSOFT_PPF_pragma_once_SUPPORT 00138 # pragma once 00139 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */ 00140 00141 /* ////////////////////////////////////////////////////////////////////// */ 00142 00143 #endif /* !PANTHEIOS_INCL_PANTHEIOS_UTIL_SEVERITY_H_WINDOWSEVENTLOG */ 00144 00145 /* ///////////////////////////// end of file //////////////////////////// */
|
|
pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 |