Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleLogFacility.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 /**
26  @example ExampleLogFacility.cpp
27  @relates LogFacility
28  @brief Example for using the logging facility
29  @ingroup g_examples
30  @author MIP
31 */
32 
33 #include <stdlib.h>
34 // BIAS
35 #include <Base/Debug/LogFacility.hh>
36 
37 using namespace BIAS;
38 using namespace std;
39 /** \cond HIDDEN_SYMBOLS*/
40 class MyTestClass {
41 public:
42  MyTestClass() {
43  };
44 
45 };
46 /** \endcond */
47 
48 int main(int argc, char *argv[])
49 {
50  if (argc>1){
51  int ll=atoi(argv[1]);
52  cout <<"Now setting current loglevel to: "<<ll<<endl;
54  if (ll==5) {
57  }
58  if (ll==6){
61  }
62  }
63 
64  if (argc>2){
65  cout <<"Now setting log stream tofile: "<<argv[2]<<endl;
67  }
68 
69  // this is the full qualified official usage of the LFwithout checking level
70  LogFacility::Instance()->GetLogStream()<<"Ok, starting up LogFacility"<<endl;
71 
72 
73  // this macros accepts arbitrary stream-concatenations, checks loglevel
74  // and codeinfo
75  BIASLOG(BIAS_LOG_DEBUG,"This is a debug line number:"<<2);
76 
77  // this is the short form of the above:
78  BLD("This is a debug line number:"<<3);
79 
80  BLI("This is an info line");
81  BLW("This is a warning line");
82  BLF("This is a fatal error");
83 
84 
85  return 0;
86 }
87 
bool OpenLogFile(const std::string &sFileName)
Definition: LogFacility.hh:135
BIAS_LOG_LEVEL
Definition: LogFacility.hh:112
void SetShowCodeInfo(bool b)
Definition: LogFacility.hh:192
static LogFacility * Instance()
Definition: LogFacility.hh:124
bool SetLogLevel(BIAS_LOG_LEVEL dLogLevel)
Definition: LogFacility.hh:147
void SetAbortOnFatal(bool b)
Definition: LogFacility.hh:199
bool GetLogStream(std::ostream &zStream)
Definition: LogFacility.hh:163