Skip to content

Commit

Permalink
rename loglevel to g_loglevel because it's global variable...
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Nov 26, 2023
1 parent ee33a58 commit 08fc163
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/driver/drv_tasmotaDeviceGroups.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static int g_dgr_socket_send = -1;
// statistics
static int g_dgr_stat_sent = 0;
static int g_dgr_stat_received = 0;
struct sockaddr_in g_mySockAddr;

static uint16_t g_dgr_send_seq = 0;

Expand Down Expand Up @@ -583,7 +584,6 @@ void DGR_ProcessIncomingPacket(char *msgbuf, int nbytes) {
g_inCmdProcessing = 0;

}
struct sockaddr_in g_mySockAddr;

void DRV_DGR_RunQuickTick() {
char msgbuf[64];
Expand Down
4 changes: 2 additions & 2 deletions src/httpserver/http_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ int http_fn_cfg_loglevel_set(http_request_t* request) {
if (http_getArg(request->url, "loglevel", tmpA, sizeof(tmpA))) {
#if WINDOWS
#else
loglevel = atoi(tmpA);
g_loglevel = atoi(tmpA);
#endif
poststr(request, "LOG level changed.");
}
Expand All @@ -1427,7 +1427,7 @@ int http_fn_cfg_loglevel_set(http_request_t* request) {
#if WINDOWS
add_label_text_field(request, "Loglevel", "loglevel", "", "<form action=\"/cfg_loglevel_set\">");
#else
add_label_numeric_field(request, "Loglevel", "loglevel", loglevel, "<form action=\"/cfg_loglevel_set\">");
add_label_numeric_field(request, "Loglevel", "loglevel", g_loglevel, "<form action=\"/cfg_loglevel_set\">");
#endif
poststr(request, "<br><br>\
<input type=\"submit\" value=\"Submit\" >\
Expand Down
4 changes: 2 additions & 2 deletions src/httpserver/rest_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ static int http_rest_get_channelTypes(http_request_t* request) {
static int http_rest_get_logconfig(http_request_t* request) {
int i;
http_setup(request, httpMimeTypeJson);
hprintf255(request, "{\"level\":%d,", loglevel);
hprintf255(request, "{\"level\":%d,", g_loglevel);
hprintf255(request, "\"features\":%d,", logfeatures);
poststr(request, "\"levelnames\":[");
for (i = 0; i < LOG_MAX; i++) {
Expand Down Expand Up @@ -794,7 +794,7 @@ static int http_rest_post_logconfig(http_request_t* request) {
if (t[i + 1].type != JSMN_PRIMITIVE) {
continue; /* We expect groups to be an array of strings */
}
loglevel = atoi(json_str + t[i + 1].start);
g_loglevel = atoi(json_str + t[i + 1].start);
i += t[i + 1].size + 1;
}
else if (jsoneq(json_str, &t[i], "features") == 0) {
Expand Down
8 changes: 4 additions & 4 deletions src/logging/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

extern uint8_t g_StartupDelayOver;

int loglevel = LOG_INFO; // default to info
int g_loglevel = LOG_INFO; // default to info
unsigned int logfeatures = (
(1 << 0) |
(1 << 1) |
Expand Down Expand Up @@ -289,7 +289,7 @@ void addLogAdv(int level, int feature, const char* fmt, ...)
if (!((1 << feature) & logfeatures)) {
return;
}
if (level > loglevel) {
if (level > g_loglevel) {
return;
}

Expand Down Expand Up @@ -748,7 +748,7 @@ commandResult_t log_command(const void* context, const char* cmd, const char* ar
res = sscanf(args, "%d", &level);
if (res == 1) {
if ((level >= 0) && (level <= 9)) {
loglevel = level;
g_loglevel = level;
result = CMD_RES_OK;
ADDLOG_DEBUG(LOG_FEATURE_CMD, "loglevel set %d", level);
}
Expand All @@ -758,7 +758,7 @@ commandResult_t log_command(const void* context, const char* cmd, const char* ar
}
}
else {
ADDLOG_ERROR(LOG_FEATURE_CMD, "loglevel '%s' invalid? current is %i", args, loglevel);
ADDLOG_ERROR(LOG_FEATURE_CMD, "loglevel '%s' invalid? current is %i", args, g_loglevel);
result = CMD_RES_BAD_ARGUMENT;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/logging/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void LOG_SetRawSocketCallback(int newFD);
#define ADDLOGF_EXTRADEBUG(fmt, ...) addLogAdv(LOG_EXTRADEBUG, LOG_FEATURE, fmt, ##__VA_ARGS__)


extern int loglevel;
extern int g_loglevel;
extern char *loglevelnames[];

extern unsigned int logfeatures;
Expand Down

0 comments on commit 08fc163

Please sign in to comment.