cl_log.h revision 219820
1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff/* 37219820Sjeff * Abstract: 38219820Sjeff * Declaration of logging mechanisms. 39219820Sjeff */ 40219820Sjeff 41219820Sjeff#ifndef _CL_LOG_H_ 42219820Sjeff#define _CL_LOG_H_ 43219820Sjeff 44219820Sjeff#include <complib/cl_types.h> 45219820Sjeff 46219820Sjeff#ifdef __cplusplus 47219820Sjeff# define BEGIN_C_DECLS extern "C" { 48219820Sjeff# define END_C_DECLS } 49219820Sjeff#else /* !__cplusplus */ 50219820Sjeff# define BEGIN_C_DECLS 51219820Sjeff# define END_C_DECLS 52219820Sjeff#endif /* __cplusplus */ 53219820Sjeff 54219820SjeffBEGIN_C_DECLS 55219820Sjeff/****h* Component Library/Log Provider 56219820Sjeff* NAME 57219820Sjeff* Log Provider 58219820Sjeff* 59219820Sjeff* DESCRIPTION 60219820Sjeff* The log provider allows users to log information in a system log instead of 61219820Sjeff* the console or debugger target. 62219820Sjeff**********/ 63219820Sjeff/****d* Component Library: Log Provider/cl_log_type_t 64219820Sjeff* NAME 65219820Sjeff* cl_log_type_t 66219820Sjeff* 67219820Sjeff* DESCRIPTION 68219820Sjeff* The cl_log_type_t enumerated type is used to differentiate between 69219820Sjeff* different types of log entries. 70219820Sjeff* 71219820Sjeff* SYNOPSIS 72219820Sjeff*/ 73219820Sjefftypedef enum _cl_log_type { 74219820Sjeff CL_LOG_INFO, 75219820Sjeff CL_LOG_WARN, 76219820Sjeff CL_LOG_ERROR 77219820Sjeff} cl_log_type_t; 78219820Sjeff/* 79219820Sjeff* VALUES 80219820Sjeff* CL_LOG_INFO 81219820Sjeff* Indicates a log entry is purely informational. 82219820Sjeff* 83219820Sjeff* CL_LOG_WARN 84219820Sjeff* Indicates a log entry is a warning but non-fatal. 85219820Sjeff* 86219820Sjeff* CL_LOG_ERROR 87219820Sjeff* Indicates a log entry is a fatal error. 88219820Sjeff* 89219820Sjeff* SEE ALSO 90219820Sjeff* Log Provider, cl_log_event 91219820Sjeff*********/ 92219820Sjeff 93219820Sjeff/****f* Component Library: Log Provider/cl_log_event 94219820Sjeff* NAME 95219820Sjeff* cl_log_event 96219820Sjeff* 97219820Sjeff* DESCRIPTION 98219820Sjeff* The cl_log_event function adds a new entry to the system log. 99219820Sjeff* 100219820Sjeff* SYNOPSIS 101219820Sjeff*/ 102219820Sjeffvoid 103219820Sjeffcl_log_event(IN const char *const name, 104219820Sjeff IN const cl_log_type_t type, 105219820Sjeff IN const char *const message, 106219820Sjeff IN const void *const p_data OPTIONAL, IN const uint32_t data_len); 107219820Sjeff/* 108219820Sjeff* PARAMETERS 109219820Sjeff* name 110219820Sjeff* [in] Pointer to an ANSI string containing the name of the source for 111219820Sjeff* the log entry. 112219820Sjeff* 113219820Sjeff* type 114219820Sjeff* [in] Defines the type of log entry to add to the system log. 115219820Sjeff* See the definition of cl_log_type_t for acceptable values. 116219820Sjeff* 117219820Sjeff* message 118219820Sjeff* [in] Pointer to an ANSI string containing the text for the log entry. 119219820Sjeff* The message should not be terminated with a new line, as the log 120219820Sjeff* provider appends a new line to all log entries. 121219820Sjeff* 122219820Sjeff* p_data 123219820Sjeff* [in] Optional pointer to data providing context for the log entry. 124219820Sjeff* At most 256 bytes of data can be successfully logged. 125219820Sjeff* 126219820Sjeff* data_len 127219820Sjeff* [in] Length of the buffer pointed to by the p_data parameter. Ignored 128219820Sjeff* if p_data is NULL. 129219820Sjeff* 130219820Sjeff* RETURN VALUE 131219820Sjeff* This function does not return a value. 132219820Sjeff* 133219820Sjeff* NOTES 134219820Sjeff* If the data length exceeds the maximum supported, the event is logged 135219820Sjeff* without its accompanying data. 136219820Sjeff* 137219820Sjeff* SEE ALSO 138219820Sjeff* Log Provider, cl_log_type_t 139219820Sjeff*********/ 140219820Sjeff 141219820SjeffEND_C_DECLS 142219820Sjeff#endif /* _CL_LOG_H_ */ 143