Salome HOME
Porting KERNEL on new XML reader.
[modules/kernel.git] / src / Logger / SALOME_Logger_Server.hxx
1 //  SALOME Logger : CORBA server managing trace output
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
6 //
7 //  File   : SALOME_Logger_Server.hxx
8 //  Author : Vasily Rusyaev
9 //  Module : SALOME
10
11 #if !defined SALOME_Logger_Server_include
12 #define SALOME_Logger_Server_include
13
14 #ifndef WNT
15 #include <fstream.h>
16 #else
17 #include <fstream>
18 #include <iosfwd>
19 #endif
20 #include <omnithread.h>
21 #include "Logger.hh"
22
23 #ifdef WNT
24 # if defined LOGGER_EXPORTS
25 #  define LOGGER_EXPORT __declspec( dllexport )
26 # else
27 #  define LOGGER_EXPORT __declspec( dllimport )
28 # endif
29 #else
30 # define LOGGER_EXPORT
31 #endif
32
33
34 class LOGGER_EXPORT Logger :
35   public POA_SALOME_Logger::Logger
36 {
37 public:
38         //constructor w/o parameters
39         //all messages will be put into terminal via cout
40         Logger();
41         //constructor with parameter, filename is output file
42         //all messages will be put into special file passed as parameter
43         Logger(const char *filename);
44         virtual ~Logger();
45         //put message into one special place for all servers
46         void putMessage(const char* message);
47         void ping();
48 private:
49         //if m_putIntoFile is true all messages will be put into special 
50         //otherwise all messages will be put into terminal via cout 
51         bool m_putIntoFile;
52         //ofstream class specialized for disk file output
53 #ifndef WNT
54         ofstream m_outputFile; 
55 #else
56                 std::ofstream m_outputFile; 
57 #endif
58         //synchronisation object
59         static omni_mutex myLock;
60 };
61
62 #endif // !defined(SALOME_Logger_Server_include)