~ubuntu-branches/ubuntu/saucy/juffed/saucy

« back to all changes in this revision

Viewing changes to src/lib/Log.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2011-04-30 13:43:26 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430134326-0bnvvo5z2medbdxi
Tags: 0.9.1137-1
* New upstream release.
* Remove debian/juffed.1, added upstream (in debian.in).
* Remove debian/patches/static.patch: we can now bundle the .so after
  upstream has resolved soname issues.
* debian/control:
  - Bump Standards-Version to 0.9.2.
  - Update homepage.
  - Do not build-depend on chrpath, not needed anymore.
* debian/rules:
  - Remove chrpath rule, not needed anymore.
* Add juffed-dev and juffed-plugins packages.
* Do not install the libkeybindings.so plugin: causes a segfault on my
  amd64 machine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
JuffEd - An advanced text editor
3
 
Copyright 2007-2009 Mikhail Murzin
 
3
Copyright 2007-2010 Mikhail Murzin
4
4
 
5
5
This program is free software; you can redistribute it and/or
6
6
modify it under the terms of the GNU General Public License 
18
18
 
19
19
#include <QDebug>
20
20
 
 
21
#include "AppInfo.h"
21
22
#include "Log.h"
22
23
 
23
24
//      Qt headers
24
25
#include <QtCore/QDateTime>
25
26
#include <QtCore/QFile>
 
27
#include <QtCore/QFileInfo>
26
28
#include <QtCore/QObject>
27
29
 
28
30
#ifdef Q_OS_WIN
29
31
#include <QtGui/QMessageBox>
30
32
#endif
31
33
 
32
 
//      local headers
33
 
#include "AppInfo.h"
34
 
 
35
34
namespace Log {
36
35
 
37
36
#ifdef Q_OS_WIN
77
76
#ifdef Q_OS_WIN
78
77
                printToLog(str, canBeSkipped);
79
78
#else
 
79
                Q_UNUSED(canBeSkipped);
80
80
                qDebug() << QDateTime::currentDateTime().toString("[hh:mm:ss]") << str;
81
81
#endif
82
82
}
97
97
#ifdef Q_OS_WIN
98
98
                printToLog(str, canBeSkipped);
99
99
#else
 
100
                Q_UNUSED(canBeSkipped);
100
101
                qWarning() << QDateTime::currentDateTime().toString("[hh:mm:ss]") << str;
101
102
#endif
102
103
        }
103
104
};
104
105
 
 
106
 
 
107
 
 
108
 
 
109
int Logger::indent_ = 0;
 
110
 
 
111
Logger::Logger(const char* func, const char* file, int line) : func_(func), file_(file), line_(line) {
 
112
        indent_ += 2;
 
113
//      qDebug() << QString("%1Entering %2 (%3:%4)").arg(QString().fill(' ', indent_)).arg(func_).arg(QFileInfo(file_).fileName()).arg(line_);
 
114
        Log::debug(QString("%1Entering %2 (%3:%4)").arg(QString().fill(' ', indent_)).arg(func_).arg(QFileInfo(file_).fileName()).arg(line_), true);
 
115
}
 
116
 
 
117
Logger::~Logger() {
 
118
//      qDebug() << QString("%1Leaving  %2 (%3)").arg(QString().fill(' ', indent_)).arg(func_).arg(QFileInfo(file_).fileName());
 
119
        Log::debug(QString("%1Leaving  %2 (%3)").arg(QString().fill(' ', indent_)).arg(func_).arg(QFileInfo(file_).fileName()), true);
 
120
        indent_ -= 2;
 
121
}