~ubuntu-branches/ubuntu/lucid/structure-synth/lucid

« back to all changes in this revision

Viewing changes to SyntopiaCore/Logging/Logging.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2009-04-13 13:28:45 UTC
  • Revision ID: james.westby@ubuntu.com-20090413132845-d7d42t4llxjxq0ez
Tags: upstream-0.9
ImportĀ upstreamĀ versionĀ 0.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "Logging.h"
 
2
 
 
3
 
 
4
#ifdef WIN32
 
5
#include "windows.h"
 
6
#endif
 
7
 
 
8
/// TODO's
 
9
/// - Nested log entris
 
10
/// - Time
 
11
/// - Setting a log view level
 
12
 
 
13
 
 
14
namespace SyntopiaCore {
 
15
        namespace Logging {     
 
16
                QVector<Logger*> Logger::loggers;
 
17
 
 
18
                void LOG(QString message, LogLevel priority) {
 
19
                        
 
20
                        // On Windows this allows us to see debug in the Output::Debug window while running.
 
21
                        #ifdef WIN32
 
22
                                OutputDebugString((LPCWSTR) (message+"\r\n").utf16());
 
23
                        #endif
 
24
 
 
25
                        for (int i = 0; i < Logger::loggers.size(); i++) {
 
26
                                Logger::loggers[i]->log(message, priority);
 
27
                        }
 
28
                }
 
29
 
 
30
                /// Useful aliases
 
31
                void Debug(QString text) { LOG(text, DebugLevel); }
 
32
                void INFO(QString text) { LOG(text, InfoLevel); }
 
33
                void WARNING(QString text) { LOG(text, WarningLevel); }
 
34
                void CRITICAL(QString text) { LOG(text, CriticalLevel); }
 
35
        }
 
36
}
 
37