Browse Source

!1270 modify log level

Merge pull request !1270 from fary86/change_logging_level
tags/v0.3.0-alpha
mindspore-ci-bot Gitee 5 years ago
parent
commit
e87721d8d8
1 changed files with 15 additions and 2 deletions
  1. +15
    -2
      mindspore/ccsrc/utils/log_adapter.cc

+ 15
- 2
mindspore/ccsrc/utils/log_adapter.cc View File

@@ -248,8 +248,20 @@ enum LogConfigToken {
VARIABLE, // '[A-Za-z][A-Za-z0-9_]*'
NUMBER, // [0-9]+
COMMA, // ','
COLON, // ';'
COLON, // ':'
EOS, // End Of String, '\0'
NUM_LOG_CFG_TOKENS
};

static const char *g_tok_names[NUM_LOG_CFG_TOKENS] = {
"invalid", // indicate invalid token
"{", // '{'
"}", // '}'
"variable", // '[A-Za-z][A-Za-z0-9_]*'
"number", // [0-9]+
",", // ','
":", // ':'
"end-of-string", // End Of String, '\0'
};

static inline bool IsAlpha(char ch) { return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); }
@@ -347,7 +359,8 @@ class LogConfigParser {

bool Expect(LogConfigToken expected, LogConfigToken tok) {
if (expected != tok) {
MS_LOG(ERROR) << "Expect " << expected << ", but got " << tok;
MS_LOG(WARNING) << "Parse submodule log configuration text error, expect `" << g_tok_names[expected]
<< "`, but got `" << g_tok_names[tok] << "`. The whole configuration will be ignored.";
return false;
}
return true;


Loading…
Cancel
Save