Skip to content

Commit 0a4cdbe

Browse files
committed
tidy(main):1.8.18, 优化日志打印
1 parent 21322b0 commit 0a4cdbe

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

modules/main/context_imp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <tbox/base/catch_throw.h>
3131
#include <tbox/util/string.h>
3232
#include <tbox/util/json.h>
33+
#include <tbox/util/fs.h>
3334
#include <tbox/terminal/session.h>
3435

3536
#include "main.h"
@@ -124,7 +125,7 @@ bool ContextImp::initialize(const char* proc_name, const Json &cfg)
124125
std::ostringstream oss;
125126
oss <<
126127
"\r\n"
127-
"Welcome to '" << proc_name << "' main terminal!\r\n"
128+
"Welcome to " << util::fs::Basename(proc_name) << " main terminal!\r\n"
128129
"\r\n"
129130
"This program is based on cpp-tbox which designed by Hevake Lee.\r\n"
130131
"Repository: https://github.com/cpp-main/cpp-tbox\r\n"

modules/main/misc.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ void GetAppVersion(int &major, int &minor, int &rev, int &build)
8383

8484
__attribute__((weak)) void OnAbnormalExit() { }
8585

86-
void SayHello()
86+
void SayHi()
8787
{
88-
LogInfo("=== CPP-TBOX MAIN STARTUP ===");
88+
LogImportant("=== CPP-TBOX MAIN STARTUP ===");
8989
LogInfo("App Describe: %s", GetAppDescribe().c_str());
9090

9191
int major, minor, rev, build;
@@ -96,6 +96,11 @@ void SayHello()
9696
LogInfo("Tbox Version: %d.%d.%d", major, minor, rev);
9797
}
9898

99+
void SayBye()
100+
{
101+
LogImportant("=== CPP-TBOX MAIN END ===");
102+
}
103+
99104
void AbnormalExit()
100105
{
101106
OnAbnormalExit();

modules/main/run_in_backend.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ extern void UninstallErrorSignals();
4444
extern void InstallTerminate();
4545

4646
extern void RegisterApps(Module &root, Context &ctx);
47-
extern void SayHello();
47+
48+
extern void SayHi();
49+
extern void SayBye();
4850

4951
extern std::function<void()> error_exit_func;
5052

@@ -92,7 +94,7 @@ void RunInBackend()
9294

9395
void End()
9496
{
95-
LogInfo("Bye!");
97+
SayBye();
9698

9799
LogOutput_Enable();
98100
_runtime->log.cleanup();
@@ -147,7 +149,7 @@ bool Start(int argc, char **argv)
147149
log.initialize(argv[0], ctx, js_conf);
148150
LogOutput_Disable();
149151

150-
SayHello();
152+
SayHi();
151153

152154
error_exit_func = [&] {
153155
log.cleanup();

modules/main/run_in_frontend.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ extern void UninstallErrorSignals();
4444
extern void InstallTerminate();
4545

4646
extern void RegisterApps(Module &root, Context &ctx);
47-
extern void SayHello();
47+
48+
extern void SayHi();
49+
extern void SayBye();
4850

4951
extern std::function<void()> error_exit_func;
5052

@@ -135,7 +137,7 @@ int Main(int argc, char **argv)
135137
log.initialize(argv[0], ctx, js_conf);
136138
LogOutput_Disable();
137139

138-
SayHello();
140+
SayHi();
139141

140142
//! 注册异常退出时的动作,在异常信号触发时调用
141143
error_exit_func = [&] {
@@ -162,7 +164,7 @@ int Main(int argc, char **argv)
162164
LogErr("Context init fail");
163165
}
164166

165-
LogInfo("Bye!");
167+
SayBye();
166168

167169
LogOutput_Enable();
168170
log.cleanup();

version.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
# TBOX版本号
2222
TBOX_VERSION_MAJOR := 1
2323
TBOX_VERSION_MINOR := 8
24-
TBOX_VERSION_REVISION := 17
24+
TBOX_VERSION_REVISION := 18

0 commit comments

Comments
 (0)