Skip to content

Commit

Permalink
Extra logging in Params
Browse files Browse the repository at this point in the history
  • Loading branch information
andiradulescu committed Nov 23, 2023
1 parent 5d12b44 commit 8fa196f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 7 additions & 2 deletions common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <csignal>
#include <unordered_map>

#include "common/swaglog.h"
#include "common/util.h"
#include "system/hardware/hw.h"

Expand Down Expand Up @@ -282,7 +281,13 @@ int Params::remove(const std::string &key) {

std::string Params::get(const std::string &key, bool block) {
if (!block) {
return util::read_file(getParamPath(key));
std::string value = util::read_file(getParamPath(key));

if (strcmp(key, "GsmApn") == 0) {
LOGE("Params::get %s: %s", key, value);
}

return value;
} else {
// blocking read until successful
params_do_exit = 0;
Expand Down
10 changes: 9 additions & 1 deletion common/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <string>
#include <vector>

#include "common/swaglog.h"

enum ParamKeyType {
PERSISTENT = 0x02,
CLEAR_ON_MANAGER_START = 0x04,
Expand All @@ -24,7 +26,13 @@ class Params {
bool checkKey(const std::string &key);
ParamKeyType getKeyType(const std::string &key);
inline std::string getParamPath(const std::string &key = {}) {
return params_path + prefix + (key.empty() ? "" : "/" + key);
std::string path = params_path + prefix + (key.empty() ? "" : "/" + key);

if (strcmp(key, "GsmApn") == 0) {
LOGE("Params path: %s", path);
}

return path;
}

// Delete a value
Expand Down

0 comments on commit 8fa196f

Please sign in to comment.