File: Logging.cpp

package info (click to toggle)
structure-synth 1.0.0-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,072 kB
  • ctags: 1,176
  • sloc: cpp: 7,070; python: 167; makefile: 66; lisp: 25
file content (37 lines) | stat: -rw-r--r-- 855 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "Logging.h"


#ifdef WIN32
#include "windows.h"
#endif

/// TODO's
/// - Nested log entris
/// - Time
/// - Setting a log view level


namespace SyntopiaCore {
	namespace Logging {	
		QVector<Logger*> Logger::loggers;

		void LOG(QString message, LogLevel priority) {
			
			// On Windows this allows us to see debug in the Output::Debug window while running.
			#ifdef WIN32
				OutputDebugString((LPCWSTR) (message+"\r\n").utf16());
			#endif

			for (int i = 0; i < Logger::loggers.size(); i++) {
				Logger::loggers[i]->log(message, priority);
			}
		}

		/// Useful aliases
		void Debug(QString text) { LOG(text, DebugLevel); }
		void INFO(QString text) { LOG(text, InfoLevel); }
		void WARNING(QString text) { LOG(text, WarningLevel); }
		void CRITICAL(QString text) { LOG(text, CriticalLevel); }
	}
}