StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDbMessenger.cc
1 /***************************************************************************
2  *
3  * $Id: StDbMessenger.cc,v 1.4 2004/01/15 00:02:25 fisyak Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Implementation of StDbMessService used within StDbLib
9  * in stand-alone mode
10  *
11  ***************************************************************************
12  *
13  * $Log: StDbMessenger.cc,v $
14  * Revision 1.4 2004/01/15 00:02:25 fisyak
15  * Replace ostringstream => StString, add option for alpha
16  *
17  * Revision 1.3 2003/09/16 22:44:17 porter
18  * got rid of all ostrstream objects; replaced with StString+string.
19  * modified rules.make and added file stdb_streams.h for standalone compilation
20  *
21  * Revision 1.2 2003/09/02 17:57:49 perev
22  * gcc 3.2 updates + WarnOff
23  *
24  * Revision 1.1 2001/01/22 18:37:57 porter
25  * Update of code needed in next year running. This update has little
26  * effect on the interface (only 1 method has been changed in the interface).
27  * Code also preserves backwards compatibility so that old versions of
28  * StDbLib can read new table structures.
29  * -Important features:
30  * a. more efficient low-level table structure (see StDbSql.cc)
31  * b. more flexible indexing for new systems (see StDbElememtIndex.cc)
32  * c. environment variable override KEYS for each database
33  * d. StMessage support & clock-time logging diagnostics
34  * -Cosmetic features
35  * e. hid stl behind interfaces (see new *Impl.* files) to again allow rootcint access
36  * f. removed codes that have been obsolete for awhile (e.g. db factories)
37  * & renamed some classes for clarity (e.g. tableQuery became StDataBaseI
38  * and mysqlAccessor became StDbSql)
39  *
40  *
41  **************************************************************************/
42 #include <string.h>
43 #include "stdb_streams.h"
44 #include "StDbMessenger.hh"
45 
47 
48 void
49 StDbMessenger::printMessage(const char* message, StDbMessLevel dbLevel, int lineNumber, const char* className, const char* methodName) {
50 
51 if(dbLevel<mdbLevel)return;
52 
53  char lString[64];
54  switch(dbLevel){
55  case dbMDebug:
56  {
57  strcpy(lString,"Debug");
58  break;
59  }
60  case dbMWarn:
61  {
62  strcpy(lString,"Warning");
63  break;
64  }
65  case dbMConnect:
66  {
67  strcpy(lString,"Info");
68  break;
69  }
70  case dbMErr:
71  {
72  strcpy(lString,"Error");
73  break;
74  }
75  default:
76  {
77  strcpy(lString," ");
78  break;
79  }
80  }
81 printMessage(message,(const char*)lString,lineNumber,className,methodName);
82 }
83 
85 
86 void
87 StDbMessenger::printMessage(const char* message, const char* levelString, int lineNumber, const char* className, const char* methodName) {
88  mos<<" *** "<<levelString<<" line="<<lineNumber<<" *** ";
89  mos<<className<<"::"<<methodName<<" "<<endl<<message<<endl;
90 }
91 
92 
93 
94 
95