Scope
ScopeLogger.h
1 #pragma once
2 
3 // Forward declarations
4 namespace scope {
5  namespace gui {
6  class CLogFrame;
7  }
8  namespace parameters {
9  class Window;
10  }
11 }
12 
13 namespace scope {
14 
16 enum log_message_type {
17  log_info = 0x01,
18  log_warning = 0x02,
19  log_error = 0x04,
20  log_all = log_info | log_warning | log_error
21 };
22 
24 class ScopeLogger {
25 
26 protected:
28  class Impl;
29 
31  Impl* const pimpl;
32 
33 protected:
36  Impl& GetImpl(const log_message_type& filem, const log_message_type& consolem, const log_message_type& logboxm);
37 
39  Impl* const Pimpl();
40 
41 public:
43  ScopeLogger(const log_message_type& _filem = log_all
44  , const log_message_type& _consolem = log_all
45  , const log_message_type& _logboxm = log_all);
46 
47  ~ScopeLogger() {}
48 
50  void SetFilepath(const std::wstring& _filepath = L"C:\\ScopeData");
51 
53  void Log(const std::wstring& message, const log_message_type& msgtype);
54 
56  void AttachLogFrame(gui::CLogFrame* const _logframe);
57 
59  HWND GetLogFrameWindow();
60 
62  bool HasLogFrame();
63 
65  void GetUserLoggings();
66 
68  void DetachLogFrame();
69 
71  void Shutdown();
72 };
73 
74 }
void GetUserLoggings()
Gets the text in the logbook window and calls FlushLogbox.
Definition: ScopeLogger.cpp:42
void DetachLogFrame()
Detaches a CLogFrame.
Definition: ScopeLogger.cpp:46
Impl & GetImpl(const log_message_type &filem, const log_message_type &consolem, const log_message_type &logboxm)
Has the local static implementation object static local variable is in there.
Definition: ScopeLogger.cpp:9
Implementation class of the ScopeLogger.
Definition: ScopeLogger_p.h:12
void SetFilepath(const std::wstring &_filepath=L"C:\\ScopeData")
Sets the filepath and creates logfile.
Definition: ScopeLogger.cpp:22
A logger class to log various messages and user comments.
Definition: ScopeLogger.h:24
void Log(const std::wstring &message, const log_message_type &msgtype)
Logs a message.
Definition: ScopeLogger.cpp:26
void Shutdown()
Calls ScopeLogger::Impl::Shutdown.
Definition: ScopeLogger.cpp:50
Frame window class for the log.
Definition: LogFrame.h:10
Impl *const Pimpl()
Definition: ScopeLogger.cpp:14
void AttachLogFrame(gui::CLogFrame *const _logframe)
Attaches a CLogFrame as the logbook window.
Definition: ScopeLogger.cpp:30
ScopeLogger(const log_message_type &_filem=log_all, const log_message_type &_consolem=log_all, const log_message_type &_logboxm=log_all)
Sets the pimpl from GetImpl.
Definition: ScopeLogger.cpp:18
Impl *const pimpl
pointer to the implementation
Definition: ScopeLogger.h:28
HWND GetLogFrameWindow()
Saves log frame parameters into Window (for recreating windows on startup).
Definition: ScopeLogger.cpp:34