From 96a894834650e219cdd9b4c9756f7b1790bcd838 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 19 五月 2021 11:12:02 +0800
Subject: [PATCH] some error msg.

---
 box/center_main.cc |   12 +++++++++---
 box/box.cc         |    4 ++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/box/box.cc b/box/box.cc
index 6f07fa7..7bea9a3 100644
--- a/box/box.cc
+++ b/box/box.cc
@@ -89,11 +89,11 @@
 void Help()
 {
 	PrintLn("%s : bhome shared memory message queue box application.", kOrigName.c_str());
-	PrintLn("usage:");
+	PrintLn("%s", "usage:");
 	PrintLn("\t1) %s [function [options]...]", kOrigName.c_str());
 	PrintLn("\t2) rename or link %s to a function name then run it directly.", kOrigName.c_str());
 	PrintLn();
-	PrintLn("supported functions:");
+	PrintLn("%s", "supported functions:");
 	std::map<std::string, std::string> funcs;
 	auto getInfo = [&](const std::string &name, const std::string &desc) {
 		funcs[name] = desc;
diff --git a/box/center_main.cc b/box/center_main.cc
index f70962f..58287e6 100644
--- a/box/center_main.cc
+++ b/box/center_main.cc
@@ -103,14 +103,18 @@
 
 	auto &shm = BHomeShm();
 	if (!CenterInit(shm)) {
-		LOG_FATAL() << "init memory error.";
+		auto msg = "init memory error.";
+		LOG_FATAL() << msg;
+		printf("%s\n", msg);
 		exit(0);
 	}
 	GlobalInit(shm);
 
 	InstanceFlag inst(shm, kCenterRunningFlag);
 	if (!inst.TryStartAsFirstInstance()) {
-		LOG_INFO() << "another instance is running, exit.";
+		auto msg = "another instance is running, exit.";
+		LOG_INFO() << msg;
+		printf("%s\n", msg);
 		return 0;
 	}
 
@@ -121,7 +125,9 @@
 	BHCenter center(shm);
 	center.Start();
 
-	LOG_INFO() << "center started ...";
+	auto msg = "center started ...";
+	LOG_INFO() << msg;
+	printf("%s\n", msg);
 	WaitForSignals({SIGINT, SIGTERM});
 	center.Stop();
 	LOG_INFO() << "center stopped.";

--
Gitblit v1.8.0