projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename create_context_menu() to create_header_context_menu()
[pulseview.git]
/
pv
/
logging.cpp
diff --git
a/pv/logging.cpp
b/pv/logging.cpp
index b0355168dbb640438db4f62e1b6661e9a2e3826d..dea333e534489b78bae632da28ccad90c56e35bd 100644
(file)
--- a/
pv/logging.cpp
+++ b/
pv/logging.cpp
@@
-28,15
+28,18
@@
#include <QApplication>
#include <QApplication>
+using std::lock_guard;
+
namespace pv {
Logging logging;
namespace pv {
Logging logging;
+const int Logging::MIN_BUFFER_SIZE = 10;
const int Logging::MAX_BUFFER_SIZE = 50000;
Logging::~Logging()
{
const int Logging::MAX_BUFFER_SIZE = 50000;
Logging::~Logging()
{
- qInstallMessageHandler(
0
);
+ qInstallMessageHandler(
nullptr
);
sr_log_callback_set_default();
#ifdef ENABLE_DECODE
srd_log_callback_set_default();
sr_log_callback_set_default();
#ifdef ENABLE_DECODE
srd_log_callback_set_default();
@@
-55,9
+58,9
@@
void Logging::init()
buffer_.reserve(buffer_size_);
qInstallMessageHandler(log_pv);
buffer_.reserve(buffer_size_);
qInstallMessageHandler(log_pv);
- sr_log_callback_set(log_
libsigrok
, nullptr);
+ sr_log_callback_set(log_
sr
, nullptr);
#ifdef ENABLE_DECODE
#ifdef ENABLE_DECODE
- srd_log_callback_set(log_
lib
srd, nullptr);
+ srd_log_callback_set(log_srd, nullptr);
#endif
GlobalSettings::add_change_handler(this);
#endif
GlobalSettings::add_change_handler(this);
@@
-72,7
+75,9
@@
int Logging::get_log_level() const
void Logging::set_log_level(int level)
{
sr_log_loglevel_set(level);
void Logging::set_log_level(int level)
{
sr_log_loglevel_set(level);
+#ifdef ENABLE_DECODE
srd_log_loglevel_set(level);
srd_log_loglevel_set(level);
+#endif
}
QString Logging::get_log() const
}
QString Logging::get_log() const
@@
-82,6
+87,8
@@
QString Logging::get_log() const
void Logging::log(const QString &text, int source)
{
void Logging::log(const QString &text, int source)
{
+ lock_guard<mutex> log_lock(log_mutex_);
+
if (buffer_.size() >= buffer_size_)
buffer_.removeFirst();
if (buffer_.size() >= buffer_size_)
buffer_.removeFirst();
@@
-129,7
+136,7
@@
void Logging::log_pv(QtMsgType type, const QMessageLogContext &context, const QS
logging.log(msg, LogSource_pv);
}
logging.log(msg, LogSource_pv);
}
-int Logging::log_
libsigrok
(void *cb_data, int loglevel, const char *format, va_list args)
+int Logging::log_
sr
(void *cb_data, int loglevel, const char *format, va_list args)
{
(void)cb_data;
(void)loglevel;
{
(void)cb_data;
(void)loglevel;
@@
-142,7
+149,7
@@
int Logging::log_libsigrok(void *cb_data, int loglevel, const char *format, va_l
}
#ifdef ENABLE_DECODE
}
#ifdef ENABLE_DECODE
-int Logging::log_
lib
srd(void *cb_data, int loglevel, const char *format, va_list args)
+int Logging::log_srd(void *cb_data, int loglevel, const char *format, va_list args)
{
(void)cb_data;
(void)loglevel;
{
(void)cb_data;
(void)loglevel;