2
0
forked from Ivasoft/DSView

update: 'libsigrok4DSL' project used new log lib

This commit is contained in:
dreamsourcelabTAI
2022-07-12 17:26:01 +08:00
parent a496f11ec1
commit b0bd52e7c2
38 changed files with 203 additions and 478 deletions

View File

@@ -139,7 +139,11 @@ int main(int argc, char *argv[])
}
//----------------------init log
dsv_log_init();
dsv_log_init();
if (bStoreLog && logLevel < XLOG_LEVEL_DBG){
logLevel = XLOG_LEVEL_DBG;
}
if (logLevel != -1){
dsv_log_level(logLevel);
@@ -191,7 +195,7 @@ bool bHighScale = true;
//----------------------run
dsv_info("----------------- version: %s-----------------", DS_VERSION_STRING);
dsv_info("Qt:%s", QT_VERSION_STR);
dsv_dbg("Qt:%s", QT_VERSION_STR);
AppControl *control = AppControl::Instance();
AppConfig::Instance().LoadAll(); //load app config

View File

@@ -68,6 +68,8 @@ void AppControl::Destroy(){
bool AppControl::Init()
{
sr_log_set_context(dsv_log_context());
// Initialise libsigrok
if (sr_init(&sr_ctx) != SR_OK)
{
@@ -146,12 +148,6 @@ const char *AppControl::GetLastError()
return m_error.c_str();
}
void AppControl::SetLogLevel(int level)
{
sr_log_loglevel_set(level);
srd_log_loglevel_set(level);
}
bool AppControl::TopWindowIsMaximized()
{
if (_topWindow != NULL){

View File

@@ -51,9 +51,7 @@ public:
void UnInit();
const char* GetLastError();
void SetLogLevel(int level);
const char* GetLastError();
inline pv::SigSession* GetSession(){
return _session;

View File

@@ -25,7 +25,7 @@
#include "config/appconfig.h"
xlog_writer *dsv_log = nullptr;
xlog_context *log_ctx = nullptr;
static xlog_context *log_ctx = nullptr;
bool b_logfile = false;
void dsv_log_init()

View File

@@ -34,10 +34,11 @@ void dsv_log_level(int l);
void dsv_log_enalbe_logfile();
#define dsv_err(fmt, args...) xlog_err(dsv_log, fmt, ## args)
#define dsv_warn(fmt, args...) xlog_warn(dsv_log, fmt, ## args)
#define dsv_info(fmt, args...) xlog_info(dsv_log, fmt, ## args)
#define dsv_dbg(fmt, args...) xlog_dbg(dsv_log, fmt, ## args)
#define dsv_detail(fmt, args...) xlog_detail(dsv_log, fmt, ## args)
#define LOG_PREFIX ""
#define dsv_err(fmt, args...) xlog_err(dsv_log, LOG_PREFIX fmt, ## args)
#define dsv_warn(fmt, args...) xlog_warn(dsv_log, LOG_PREFIX fmt, ## args)
#define dsv_info(fmt, args...) xlog_info(dsv_log, LOG_PREFIX fmt, ## args)
#define dsv_dbg(fmt, args...) xlog_dbg(dsv_log, LOG_PREFIX fmt, ## args)
#define dsv_detail(fmt, args...) xlog_detail(dsv_log, LOG_PREFIX fmt, ## args)
#endif

View File

@@ -117,7 +117,7 @@ GVariant* ProbeOptions::config_getter(
{
GVariant *data = NULL;
if (sr_config_get(sdi->driver, sdi, probe, NULL, key, &data) != SR_OK) {
dsv_warn(NULL, "%s%d", "WARNING: Failed to get value of config id:", key);
dsv_warn("%s%d", "WARNING: Failed to get value of config id:", key);
return NULL;
}
return data;

View File

@@ -60,7 +60,6 @@
#include "data/decode/decoderstatus.h"
#include "dsvdef.h"
#include "log.h"
namespace pv {