Dlf.hpp 4.83 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/******************************************************************************
 *                      dlf_write.hpp
 *
 * This file is part of the Castor project.
 * See http://castor.web.cern.ch/castor
 *
 * Copyright (C) 2003  CERN
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
20
 * @(#)$RCSfile: Dlf.hpp,v $ $Revision: 1.7 $ $Release$ $Date: 2008/03/10 09:26:08 $ $Author: waldron $
21
22
23
24
25
26
27
28
29
30
 *
 * C++ interface to DLF
 *
 * @author Sebastien Ponce
 *****************************************************************************/

#ifndef DLF_DLF_WRITE_HPP 
#define DLF_DLF_WRITE_HPP 1

// Include Files
31
#include "dlf_api.h"
32
33
#include "castor/dlf/Message.hpp"
#include "castor/dlf/Param.hpp"
34
35
#include "castor/exception/Exception.hpp"
#include <vector>
36
37
38
39
40

namespace castor {

  namespace dlf {

41
42
43
44
45
46
47
48
49
    /**
     * Vector of messages that should be declared
     * at initialization. These messages were sent to
     * dlf_addMessage before it was initialized and
     * thus have to wait here.
     */
    std::vector<std::pair<int, castor::dlf::Message*> >&
    dlf_getPendingMessages() throw();

50
51
52
    /**
     * Initialization of the DLF logging system
     * @param facilityName name of the DLF facility to use
53
     * @param messages array of messages to declare in the
54
55
     * facility. The end of the array is marked by a
     * message with negative number.
56
     * @param throws a CASTOR exception in case of failure
57
58
     */
    void dlf_init(char* facilityName,
59
60
                  Message messages[])
      throw (castor::exception::Exception);
61

62
    /**
63
64
65
66
67
68
69
     * Adds messages to the current DLF facility.
     * This method can be called before the initialization of DLF
     * if needed. In such a case, the messages will be stored
     * and added at initialization time.
     * Note that no exception will ever be thrown in case of failure.
     * Failures will actually be silently ignored in order to not
     * impact the processing.
70
71
72
73
74
75
76
     * @param offset the offset to add to each message number.
     * This is to avoid collisions with previously added messages
     * @param messages array of messages to decalre in the
     * facility. The end of the array is marked by a
     * message with negative number.
     */
    void dlf_addMessages(int offset,
77
                         Message messages[]) throw();
78

79
    /**
80
81
82
     * prints a message into dlf. Note that no exception will ever
     * be thrown in case of failure. Failures will actually be silently
     * ignored in order to not impact the processing.
83
84
85
86
87
88
89
90
91
92
93
94
95
     * @param uuid the uuid of the component issuing the message
     * @param message_no the message number in the facility.
     * @param severity the severity of the message.
     * @param numparams the number of parameters in the message
     * @param params the parameters of the message, given as an array
     * @ns_invariant the castor file concerned by the message
     * (if any), given as a name server fileId.
     */
    void dlf_writep (Cuuid_t uuid,
                     int severity,
                     int message_no,
                     int numparams = 0,
                     castor::dlf::Param params[] = 0,
96
                     struct Cns_fileid *ns_invariant = 0) throw();
97
  
98

99
    /**
100
101
102
103
104
105
106
107
108
109
110
111
112
     * wrapper to dlf_writte but it compounds the struct Cns_fileId
     * ns_invariantfrom the prints a message into dlf. Note that no
     * exception will ever
     * be thrown in case of failure. Failures will actually be silently
     * ignored in order to not impact the processing.
     * @param uuid the uuid of the component issuing the message
     * @param message_no the message number in the facility.
     * @param severity the severity of the message.
     * @param numparams the number of parameters in the message
     * @param params the parameters of the message, given as an array
     * @param fileId the castor file id
     * @param nsHost the name server
     */
113
    void dlf_writep (Cuuid_t uuid,
114
115
                     int severity,
                     int message_no,
116
                     u_signed64 fileId,
117
118
119
120
121
                     std::string nsHost,
                     int numparams = 0,
                     castor::dlf::Param params[] = 0) throw();

  } // end of namespace dlf
122
123
124
125
126

} // end of namespace castor


#endif // DLF_DLF_WRITE_HPP