WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZblLogCategory.cpp
Go to the documentation of this file.
1 /*
2  * Zuble - A run-time system for QML/Javascript applications
3  * Copyright (C) 2015 Bob Dinitto
4  *
5  * Filename: ZblLogCategory.cpp
6  * Created on: 4/19/2015
7  * Author: Bob Dinitto
8  *
9  * Zuble is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #include "ZblLogCategory.h"
26 #include "ZblLogManager.h"
27 
28 namespace Zbl
29 {
30 
32 
33 QMutex ZblLogCategory::m_categorylock(QMutex::Recursive);
34 
35 ZblLogCategory::ZblLogCategory(const char *logCategory) :
36  m_logCategory(logCategory),
37  m_categoryRegistered(false)
38 {
39 
40 }
41 
42 ZblLogCategory::ZblLogCategory(const QString logCategory) :
43  m_logCategory(logCategory.toUtf8().data()),
45 {
46 
47 }
48 
49 
51 {
53  {
54  QMutexLocker lock(&m_categorylock);
55 
56  QString categoryName(m_logCategory.categoryName());
57 
58  if(!m_categories.contains(categoryName))
59  {
60  //zDebug() << "Registering log category: " << logCategory;
61 
64 
65  m_categories.append(categoryName);
66  }
67 
68  m_categoryRegistered = true;
69  }
70 }
71 
72 } // Zbl
73 
bool appendRuleModelCategory(const QString &logCategory)
Adds a new category to the rule model. If the category already exists in the rule model the request t...
Definition: ZAndGate.cpp:6
static QMutex m_categorylock
Protects thread-safe methods of this class.
static QStringList m_categories
A list of registered log categories.
bool m_categoryRegistered
true if we have already registered this category
static ZblLogManager * m_zLog
The one and only ZblLogManager object in this process.
QLoggingCategory m_logCategory
A wrapped QLoggingCategory object for this log category.
ZblLogCategory(const char *logCategory)