MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit 96a25351 authored by Julien Wintz's avatar Julien Wintz
Browse files

Add of log filtering function for the console in logging layer.

parent f13afb58
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 15:23:18 2012 (+0100)
* Version: $Id$
* Last-Updated: Mon Mar 5 13:02:50 2012 (+0100)
* Last-Updated: Mon Mar 18 12:56:01 2013 (+0100)
* By: Julien Wintz
* Update #: 228
* Update #: 238
*/
/* Commentary:
......@@ -86,9 +86,13 @@ int main(int argc, char **argv)
qRegisterMetaType<Pixel>();
dtkLogger::instance().setLevel(dtkLog::Trace);
dtkLogger::instance().attachConsole();
dtkLogger::instance().attachConsole(dtkLog::Info);
dtkLogger::instance().attachFile(dtkLogPath(&application));
// ///////////////////////////////////////////////////////////////////
dtkLog(dtkLog::Trace) << "As console is attached with dtkLog::Info level, dtkLog() logs it only to the file.";
// /////////////////////////////////////////////////////////////////
qDebug() << "Overview of logging levels:";
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 14:40:12 2012 (+0100)
* Version: $Id$
* Last-Updated: Mon Apr 16 12:06:43 2012 (+0200)
* Last-Updated: Mon Mar 18 12:49:06 2013 (+0100)
* By: Julien Wintz
* Update #: 41
* Update #: 46
*/
/* Commentary:
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 14:37:36 2012 (+0100)
* Version: $Id$
* Last-Updated: Mon Apr 30 15:08:46 2012 (+0200)
* Last-Updated: Mon Mar 18 12:40:01 2013 (+0100)
* By: Julien Wintz
* Update #: 135
* Update #: 140
*/
/* Commentary: See credits at EOF.
......@@ -91,7 +91,14 @@ namespace dtkLog
// /////////////////////////////////////////////////////////////////
#define dtkFatal() \
dtkLogEngine(dtkLog::Fatal).stream()
dtkLogEngine(dtkLog::Fatal).stream()
// ///////////////////////////////////////////////////////////////////
// Custom level stream
// ///////////////////////////////////////////////////////////////////
#define dtkLog(level) \
dtkLogEngine(level, true).stream()
// /////////////////////////////////////////////////////////////////
// Helper functions
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 16:18:42 2012 (+0100)
* Version: $Id$
* Last-Updated: mar. nov. 6 14:39:41 2012 (+0100)
* By: Nicolas Niclausse
* Update #: 73
* Last-Updated: Mon Mar 18 12:39:12 2013 (+0100)
* By: Julien Wintz
* Update #: 82
*/
/* Commentary:
......@@ -67,6 +67,9 @@ public:
public:
QString buffer;
public:
bool custom;
};
void dtkLogEnginePrivate::write(void)
......@@ -90,7 +93,10 @@ void dtkLogEnginePrivate::write(void)
QMutexLocker lock(&(dtkLogger::instance().d->mutex));
dtkLogger::instance().write(message);
if(!this->custom)
dtkLogger::instance().write(message);
else
dtkLogger::instance().write(message, level);
} else {
......@@ -101,7 +107,10 @@ void dtkLogEnginePrivate::write(void)
QMutexLocker lock(&(dtkLogger::instance().d->mutex));
dtkLogger::instance().write(message);
if(!this->custom)
dtkLogger::instance().write(message);
else
dtkLogger::instance().write(message, level);
}
}
......@@ -110,9 +119,10 @@ void dtkLogEnginePrivate::write(void)
// dtkLogEngine
// /////////////////////////////////////////////////////////////////
dtkLogEngine::dtkLogEngine(dtkLog::Level level) : d(new dtkLogEnginePrivate)
dtkLogEngine::dtkLogEngine(dtkLog::Level level, bool custom) : d(new dtkLogEnginePrivate)
{
d->level = level;
d->custom = custom;
}
dtkLogEngine::~dtkLogEngine(void)
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 16:15:38 2012 (+0100)
* Version: $Id$
* Last-Updated: Thu Mar 1 16:58:30 2012 (+0100)
* Last-Updated: Mon Mar 18 12:33:03 2013 (+0100)
* By: Julien Wintz
* Update #: 11
* Update #: 13
*/
/* Commentary:
......@@ -30,7 +30,7 @@ class dtkLogEnginePrivate;
class DTKLOG_EXPORT dtkLogEngine
{
public:
dtkLogEngine(dtkLog::Level level);
dtkLogEngine(dtkLog::Level level, bool custom = false);
~dtkLogEngine(void);
public:
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 17:19:52 2012 (+0100)
* Version: $Id$
* Last-Updated: mar. avril 24 15:04:50 2012 (+0200)
* By: Nicolas Niclausse
* Update #: 101
* Last-Updated: Mon Mar 18 12:57:12 2013 (+0100)
* By: Julien Wintz
* Update #: 128
*/
/* Commentary:
......@@ -60,6 +60,13 @@ void dtkLogger::attachConsole(void)
d->destinations << d->console;
}
void dtkLogger::attachConsole(dtkLog::Level level)
{
d->destinations << d->console;
d->levels[d->console] = level;
}
void dtkLogger::detachConsole(void)
{
d->destinations.removeOne(d->console);
......@@ -144,3 +151,19 @@ void dtkLogger::write(const QString& message)
for(int i = 0; i < d->destinations.count(); i++)
d->destinations.at(i)->write(message);
}
void dtkLogger::write(const QString& message, dtkLog::Level level)
{
for(int i = 0; i < d->destinations.count(); i++) {
if(d->levels.keys().contains(d->destinations.at(i))) {
if(level > d->levels[d->destinations.at(i)]) {
d->destinations.at(i)->write(message);
}
} else {
d->destinations.at(i)->write(message);
}
}
}
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 17:18:31 2012 (+0100)
* Version: $Id$
* Last-Updated: mar. avril 24 15:02:52 2012 (+0200)
* By: Nicolas Niclausse
* Update #: 33
* Last-Updated: Mon Mar 18 12:36:33 2013 (+0100)
* By: Julien Wintz
* Update #: 40
*/
/* Commentary:
......@@ -44,6 +44,7 @@ public:
public:
void attachConsole(void);
void attachConsole(dtkLog::Level level);
void detachConsole(void);
public:
......@@ -65,6 +66,7 @@ private:
private:
void write(const QString& message);
void write(const QString& message, dtkLog::Level level);
private:
dtkLogger& operator=(const dtkLogger& other);
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Mar 1 17:26:54 2012 (+0100)
* Version: $Id$
* Last-Updated: Wed Apr 4 10:03:15 2012 (+0200)
* By: tkloczko
* Update #: 46
* Last-Updated: Mon Mar 18 12:25:46 2013 (+0100)
* By: Julien Wintz
* Update #: 50
*/
/* Commentary:
......@@ -31,7 +31,8 @@ class dtkLogViewList;
class dtkLoggerPrivate
{
public:
dtkLog::Level level;
dtkLog::Level level;
QHash<dtkLogDestinationPointer, dtkLog::Level> levels;
public:
dtkLogDestinationPointer console;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment