Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nnshah1 committed Apr 19, 2024
1 parent c5eb21f commit e5a682e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion include/triton/common/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class LogMessage {

private:
static const std::array<const char*, Level::kINFO + 1> LEVEL_NAMES_;
static const std::vector<char> level_name_;
std::string path_;
const int line_;
const uint32_t level_;
Expand Down
7 changes: 5 additions & 2 deletions src/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Logger::Flush()
}

const std::array<const char*, LogMessage::Level::kINFO + 1>
LogMessage::LEVEL_NAMES_{"Error", "Warning", "Info"};
LogMessage::LEVEL_NAMES_{"ERROR", "WARNING", "INFO"};
const std::vector<char> LogMessage::level_name_{'E', 'W', 'I'};

#ifdef _WIN32
Expand Down Expand Up @@ -189,11 +189,14 @@ LogMessage::~LogMessage()
case Logger::Format::kJSONL: {
TritonJson::Value logMessage(TritonJson::ValueType::OBJECT);
TritonJson::WriteBuffer buffer;
std::stringstream timestamp;
LogTimestamp(timestamp);
logMessage.AddString("file", path_);
logMessage.AddInt("line", line_);
logMessage.AddString("level", LEVEL_NAMES_[level_]);
logMessage.AddInt("pid", pid_);
logMessage.AddInt("process_id", pid_);
logMessage.AddString("message", message_.str());
logMessage.AddString("timestamp", timestamp.str());
logMessage.Write(&buffer);
gLogger_.Log(buffer.Contents());
break;
Expand Down

0 comments on commit e5a682e

Please sign in to comment.