Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:42

0001 #ifndef __SYS_LOGPI_H__
0002 #define __SYS_LOGPI_H__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                        X r d S y s L o g P I . h h                         */
0006 /*                                                                            */
0007 /*(c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University   */
0008 /*Produced by Andrew Hanushevsky for Stanford University under contract       */
0009 /*           DE-AC02-76-SFO0515 with the Deprtment of Energy                  */
0010 /*                                                                            */
0011 /* This file is part of the XRootD software suite.                            */
0012 /*                                                                            */
0013 /* XRootD is free software: you can redistribute it and/or modify it under    */
0014 /* the terms of the GNU Lesser General Public License as published by the     */
0015 /* Free Software Foundation, either version 3 of the License, or (at your     */
0016 /* option) any later version.                                                 */
0017 /*                                                                            */
0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0021 /* License for more details.                                                  */
0022 /*                                                                            */
0023 /* You should have received a copy of the GNU Lesser General Public License   */
0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0026 /*                                                                            */
0027 /* The copyright holder's institutional names and contributor's names may not */
0028 /* be used to endorse or promote products derived from this software without  */
0029 /* specific prior written permission of the institution or contributor.       */
0030 /******************************************************************************/
0031 
0032 #include <cstdlib>
0033 #include <sys/time.h>
0034 
0035 //-----------------------------------------------------------------------------
0036 //! This header file defines the plugin interface used by the logging subsystem.
0037 //! The following function is called for each message. A pointer to the
0038 //! function is returned by XrdSysLogPInit(); see the definition below. The
0039 //! log message function must be thread safe in synchronous mode as any number
0040 //! of threads may call it at the same time. In async mode, only one thread
0041 //! invokes the function for each message.
0042 //!
0043 //! @param  mtime     The time the message was generated. The time value is
0044 //!                   zero when tID is zero (see below).
0045 //! @param  tID       The thread ID that issued the message (Linux -> gettid()).
0046 //!                   If tID is zero then the msg was captured from stderr.
0047 //! @param  msg       Pointer to the null-terminaed message text.
0048 //! @param  mlen      Length of the message text (exclusive of null byte).
0049 //-----------------------------------------------------------------------------
0050 
0051 typedef void (*XrdSysLogPI_t)(struct timeval const &mtime,
0052                               unsigned long         tID,
0053                               const char           *msg,
0054                               int                   mlen);
0055 
0056 //-----------------------------------------------------------------------------
0057 //! Initialize and return a pointer to the plugin. This function must reside in
0058 //! the plugin shared library as an extern "C" function. The shared library is
0059 //! library identified by the "-l @library" command line option. This function
0060 //! is called only once during loging initialization.
0061 //!
0062 //! @param  cfgn      -> Configuration filename (nil if none).
0063 //! @param  argv      -> command line arguments after "-+xrdlog".
0064 //! @param  argc         number of command line arguments in argv.
0065 //!
0066 //! @return Upon success a pointer of type XrdSysLogPI_t which is the function
0067 //!         that handles log messages (see above). Upon failure, a nil pointer
0068 //!         should be returned. A sample deinition is shown below.
0069 //-----------------------------------------------------------------------------
0070 
0071 /*!
0072    extern "C" XrdSysLogPI_t XrdSysLogPInit(const char  *cfgn,
0073                                                  char **argv,
0074                                                  int    argc) { . . . }
0075 */
0076 
0077 typedef XrdSysLogPI_t  (*XrdSysLogPInit_t)(const char  *cfgn,
0078                                                  char **argv,
0079                                                  int    argc);
0080   
0081 //------------------------------------------------------------------------------
0082 /*! Specify the compilation version.
0083 
0084     Additionally, you *should* declare the xrootd version you used to compile
0085     your plug-in. The plugin manager automatically checks for compatibility.
0086     Declare it as follows:
0087 
0088     #include "XrdVersion.hh"
0089     XrdVERSIONINFO(XrdSysLogPInit,<name>);
0090 
0091     where <name> is a 1- to 15-character unquoted name identifying your plugin.
0092 */
0093 //------------------------------------------------------------------------------
0094 #endif