Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cf_cc_binary(
"//cuttlefish/host/libs/config/defaults",
"//cuttlefish/host/libs/config/fastboot",
"//cuttlefish/host/libs/feature:inject",
"//cuttlefish/host/libs/log_names",
"//cuttlefish/posix:symlink",
"//cuttlefish/pretty:vector",
"//libbase",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#include "cuttlefish/host/libs/config/fastboot/fastboot.h"
#include "cuttlefish/host/libs/config/fetcher_configs.h"
#include "cuttlefish/host/libs/config/log_string_to_dir.h"
#include "cuttlefish/host/libs/log_names/log_names.h"
#include "cuttlefish/host/libs/feature/inject.h"
#include "cuttlefish/posix/symlink.h"
#include "cuttlefish/pretty/vector.h"
Expand Down Expand Up @@ -105,11 +106,11 @@ Result<void> SaveConfig(const CuttlefishConfig& tmp_config_obj) {
Result<void> CreateLegacySymlinks(
const CuttlefishConfig::InstanceSpecific& instance,
const CuttlefishConfig::EnvironmentSpecific& environment) {
std::string log_files[] = {"kernel.log",
std::string log_files[] = {kLogNameKernel,
"launcher.log",
"logcat",
"metrics.log",
"modem_simulator.log",
kLogNameModemSimulator,
"crosvm_openwrt.log",
"crosvm_openwrt_boot.log"};
for (const auto& log_file : log_files) {
Expand Down Expand Up @@ -241,10 +242,10 @@ Result<std::set<std::string>> PreservingOnResume(
preserving.insert("oemlock_insecure");
// Preserve logs if restoring from a snapshot.
if (!snapshot_path.empty()) {
preserving.insert("kernel.log");
preserving.insert(kLogNameKernel);
preserving.insert("launcher.log");
preserving.insert("logcat");
preserving.insert("modem_simulator.log");
preserving.insert(kLogNameModemSimulator);
preserving.insert("crosvm_openwrt.log");
preserving.insert("crosvm_openwrt_boot.log");
preserving.insert("metrics.log");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ cf_cc_library(
"//cuttlefish/host/commands/cvd/cli/selector",
"//cuttlefish/host/commands/cvd/instances",
"//cuttlefish/host/commands/cvd/instances:instance_manager",
"//cuttlefish/host/libs/log_names",
"//cuttlefish/result",
"//libbase",
"@abseil-cpp//absl/log:check",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "cuttlefish/host/commands/cvd/cli/types.h"
#include "cuttlefish/host/commands/cvd/cli/utils.h"
#include "cuttlefish/host/commands/cvd/instances/instance_manager.h"
#include "cuttlefish/host/libs/log_names/log_names.h"
#include "cuttlefish/result/result.h"

namespace cuttlefish {
Expand Down Expand Up @@ -193,7 +194,8 @@ class CvdMonitorCommandHandler : public CvdCommandHandler {
CF_EXPECT(selector::SelectInstance(instance_manager_, request),
"Unable to select an instance");

std::string kernel_log = instance.instance_dir() + "/logs/kernel.log";
std::string kernel_log =
absl::StrCat(instance.instance_dir(), "/logs/", kLogNameKernel);
std::string launcher_log = instance.instance_dir() + "/logs/launcher.log";
std::string logcat = instance.instance_dir() + "/logs/logcat";

Expand All @@ -220,7 +222,7 @@ class CvdMonitorCommandHandler : public CvdCommandHandler {
LogMonitorDisplay display(width);

display.DrawFile(launcher_fd, "launcher.log");
display.DrawFile(kernel_fd, "kernel.log");
display.DrawFile(kernel_fd, kLogNameKernel);
display.DrawFile(logcat_fd, "logcat");

std::cout << display.Finalize() << std::flush;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cf_cc_binary(
"//cuttlefish/common/libs/utils:subprocess",
"//cuttlefish/common/libs/utils:tee_logging",
"//cuttlefish/host/libs/config:cuttlefish_config",
"//cuttlefish/host/libs/log_names",
"//cuttlefish/host/libs/zip:zip_file",
"//cuttlefish/posix:strerror",
"//cuttlefish/result",
Expand Down
3 changes: 2 additions & 1 deletion base/cvd/cuttlefish/host/commands/host_bugreport/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "cuttlefish/common/libs/utils/subprocess.h"
#include "cuttlefish/common/libs/utils/tee_logging.h"
#include "cuttlefish/host/libs/config/cuttlefish_config.h"
#include "cuttlefish/host/libs/log_names/log_names.h"
#include "cuttlefish/host/libs/zip/zip_file.h"
#include "cuttlefish/posix/strerror.h"
#include "cuttlefish/result/result.h"
Expand Down Expand Up @@ -147,7 +148,7 @@ void TakeHostBugreport(const CuttlefishConfig* config, WritableZip& archive) {
<< result.error().FormatForEnv(/* color = */ false);
}
} else {
save("kernel.log");
save(kLogNameKernel);
save("launcher.log");
save("logcat");
save("metrics.log");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cf_cc_binary(
"//cuttlefish/host/libs/config:config_instance_derived",
"//cuttlefish/host/libs/config:cuttlefish_config",
"//cuttlefish/host/libs/config:logging",
"//cuttlefish/host/libs/log_names",
"//cuttlefish/result",
"//libbase",
"@abseil-cpp//absl/log",
Expand Down
3 changes: 2 additions & 1 deletion base/cvd/cuttlefish/host/commands/kernel_log_monitor/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "cuttlefish/host/libs/config/config_instance_derived.h"
#include "cuttlefish/host/libs/config/cuttlefish_config.h"
#include "cuttlefish/host/libs/config/logging.h"
#include "cuttlefish/host/libs/log_names/log_names.h"

DEFINE_int32(log_pipe_fd, -1,
"A file descriptor representing a (UNIX) socket from which to "
Expand Down Expand Up @@ -102,7 +103,7 @@ int KernelLogMonitorMain(int argc, char** argv) {
return 2;
}

KernelLogServer klog{pipe, instance.PerInstanceLogPath("kernel.log")};
KernelLogServer klog{pipe, instance.PerInstanceLogPath(kLogNameKernel)};

for (auto subscriber_fd: subscriber_fds) {
if (subscriber_fd->IsOpen()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ cf_cc_binary(
"//cuttlefish/common/libs/utils:tee_logging",
"//cuttlefish/host/commands/modem_simulator:modem_simulator_class",
"//cuttlefish/host/libs/config:cuttlefish_config",
"//cuttlefish/host/libs/log_names",
"//libbase",
"@abseil-cpp//absl/log",
"@abseil-cpp//absl/log:check",
Expand Down
3 changes: 2 additions & 1 deletion base/cvd/cuttlefish/host/commands/modem_simulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "cuttlefish/common/libs/utils/tee_logging.h"
#include "cuttlefish/host/commands/modem_simulator/modem_simulator.h"
#include "cuttlefish/host/libs/config/cuttlefish_config.h"
#include "cuttlefish/host/libs/log_names/log_names.h"

// we can start multiple modems simultaneously; each modem
// will listen to one server fd for incoming sms/phone call
Expand Down Expand Up @@ -67,7 +68,7 @@ int ModemSimulatorMain(int argc, char** argv) {
auto config = CuttlefishConfig::Get();
auto instance = config->ForDefaultInstance();

auto modem_log_path = instance.PerInstanceLogPath("modem_simulator.log");
auto modem_log_path = instance.PerInstanceLogPath(kLogNameModemSimulator);

{
auto log_path = instance.launcher_log_path();
Expand Down
12 changes: 12 additions & 0 deletions base/cvd/cuttlefish/host/libs/log_names/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("//cuttlefish/bazel:rules.bzl", "cf_cc_library")

package(
default_visibility = ["//:android_cuttlefish"],
)

cf_cc_library(
name = "log_names",
hdrs = [
"log_names.h",
],
)
24 changes: 24 additions & 0 deletions base/cvd/cuttlefish/host/libs/log_names/log_names.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Copyright (C) 2026 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

namespace cuttlefish {

// Per instance log names.
inline constexpr char kLogNameKernel[] = "kernel.log";
inline constexpr char kLogNameModemSimulator[] = "modem_simulator.log";

} // namespace cuttlefish
Loading