From 973f30b16fe420a73c547e7e7ae5bcb9ad2f6bea Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 16 Nov 2023 23:25:35 +0100 Subject: [PATCH] src: print MKSNAPSHOT debug logs to stderr PR-URL: https://github.com/nodejs/node/pull/50759 Refs: https://github.com/nodejs/node/issues/50740 Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell Reviewed-By: Darshan Sen --- src/node_realm.cc | 2 +- src/node_snapshotable.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_realm.cc b/src/node_realm.cc index 23fb6bd55213ee..6262ed8cde59f2 100644 --- a/src/node_realm.cc +++ b/src/node_realm.cc @@ -223,7 +223,7 @@ void Realm::PrintInfoForSnapshot() { fprintf(stderr, "BaseObjects of the Realm:\n"); size_t i = 0; ForEachBaseObject([&](BaseObject* obj) { - std::cout << "#" << i++ << " " << obj << ": " << obj->MemoryInfoName() + std::cerr << "#" << i++ << " " << obj << ": " << obj->MemoryInfoName() << "\n"; }); diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc index 71d64325765048..f40669d1695a4b 100644 --- a/src/node_snapshotable.cc +++ b/src/node_snapshotable.cc @@ -1075,7 +1075,7 @@ ExitCode SnapshotBuilder::CreateSnapshot(SnapshotData* out, if (per_process::enabled_debug_list.enabled(DebugCategory::MKSNAPSHOT)) { env->ForEachRealm([](Realm* realm) { realm->PrintInfoForSnapshot(); }); - printf("Environment = %p\n", env); + fprintf(stderr, "Environment = %p\n", env); } // Serialize the native states