blob: 42eb5296d4bc49e79d1e9301efea60c1679f98c1 [file]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/developer/forensics/testing/log_message.h"
#include <lib/zx/time.h>
#include <cstdint>
namespace forensics {
namespace testing {
namespace {
constexpr zx::time_boot kLogMessageBaseTimestamp = zx::time_boot(zx::sec(15604).to_nsecs());
constexpr uint64_t kLogMessageProcessId = 7559;
constexpr uint64_t kLogMessageThreadId = 7687;
} // namespace
fuchsia_logger::LogMessage BuildLogMessage(const int32_t severity, const std::string& text,
const zx::duration timestamp_offset,
const std::vector<std::string>& tags) {
fuchsia_logger::LogMessage msg{};
msg.time(kLogMessageBaseTimestamp + timestamp_offset);
msg.pid(kLogMessageProcessId);
msg.tid(kLogMessageThreadId);
msg.tags(tags);
msg.severity(severity);
msg.msg(text);
return msg;
}
} // namespace testing
} // namespace forensics