GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NarvalCollector.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef ADF_NarvalCollector
24 #include "NarvalCollector.h"
25 #endif
26 
27 #include "ADFLogMessage.h"
28 
29 extern "C" {
30  void ada_log_message (int, const char *,int);
31 } // extern C
32 
33 using namespace ADF;
34 
35 NarvalCollector::NarvalCollector(const char *name, bool isdelbycental) :
36  LogCollector(name,isdelbycental)
37 {
38 }
39 
41 {
42 }
43 
45 {
46 /* if ( lev == LogMessage::kDebug )
47  return 0; */
48  if ( lev == LogMessage::kError )
49  return 3;
50  if ( lev == LogMessage::kWarning )
51  return 2;
52  if ( lev == LogMessage::kInfo )
53  return 1;
54 
55  return 1000;
56 }
57 
59 {
60  std::string mess =
61  alogmsg.Message();
62  if ( mess.size() > 0 ) {
63  std::string rmess = "[" + alogmsg.GetProcessName() + "::" + alogmsg.GetProcessMethod() + "] ";
64  rmess.append(mess);
65  ada_log_message (alogmsg.GetPID(),rmess.c_str(),ConvertLevel(alogmsg.GetLevel()));
66  }
67 }
68 
69 
70 
71 
72 
virtual ELevel GetLevel() const
To get the current level of the message.
virtual std::string & GetProcessMethod()
To get the current method.
Base class for a Log collector.
void ada_log_message(int, const char *, int)
virtual std::string Message() const
To get the current message.
real header file for narval/NarvalCollector.cpp
ELevel
message level
Definition: ADFLogMessage.h:95
Base class for a Log message.
Definition: ADFLogMessage.h:80
NarvalCollector(const char *name, bool isdelbycental)
header file for ADFLogMessage.cpp
virtual void DoCollect(LogMessage &)
Send messages to Narval system.
virtual std::string & GetProcessName()
To get the Process name.
virtual unsigned int GetPID() const
To get the Process ID number.
int ConvertLevel(LogMessage::ELevel lev)
to convert log level from ADF to Narval conventions