0031037: Foundation Classes - add class Message_PrinterSystemLog for printing message...
[occt.git] / src / Message / Message_PrinterSystemLog.hxx
1 // Copyright (c) 2019 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _Message_PrinterSystemLog_HeaderFile
15 #define _Message_PrinterSystemLog_HeaderFile
16
17 #include <Message_Printer.hxx>
18 #include <TCollection_AsciiString.hxx>
19
20 DEFINE_STANDARD_HANDLE(Message_PrinterSystemLog, Message_Printer)
21
22 //! Implementation of a message printer associated with system log.
23 //! Implemented for the following systems:
24 //! - Windows, through ReportEventW().
25 //! - Android, through __android_log_write().
26 //! - UNIX/Linux, through syslog().
27 class Message_PrinterSystemLog : public Message_Printer
28 {
29   DEFINE_STANDARD_RTTIEXT(Message_PrinterSystemLog, Message_Printer)
30 public:
31   
32   //! Main constructor.
33   Standard_EXPORT Message_PrinterSystemLog (const TCollection_AsciiString& theEventSourceName,
34                                             const Message_Gravity theTraceLevel = Message_Info);
35
36   //! Destructor.
37   Standard_EXPORT virtual ~Message_PrinterSystemLog();
38
39   //! Puts a message to the system log.
40   Standard_EXPORT virtual void Send (const Standard_CString theString,
41                                      const Message_Gravity theGravity,
42                                      const Standard_Boolean theToPutEndl) const Standard_OVERRIDE;
43   
44   //! Puts a message to the system log.
45   Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString,
46                                      const Message_Gravity theGravity,
47                                      const Standard_Boolean theToPutEndl) const Standard_OVERRIDE;
48   
49   //! Puts a message to the system log.
50   Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString,
51                                      const Message_Gravity theGravity,
52                                      const Standard_Boolean theToPutEndl) const Standard_OVERRIDE;
53
54 private:
55
56   TCollection_AsciiString myEventSourceName;
57 #ifdef _WIN32
58   Standard_Address myEventSource;
59 #endif
60
61 };
62
63 #endif // _Message_PrinterSystemLog_HeaderFile