Skip to content

Commit 4fc00f3

Browse files
committed
feat: enhance logging in web server and SSL error messages
1 parent da3f190 commit 4fc00f3

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ cppjson
2525
vegeta*
2626
*.bin
2727
plot.html
28+
local_dev.sh

demo/web-server/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "log/multi_logger.hpp"
77
#include "log/std_logger.hpp"
88
#include "process_ctrl.hpp"
9+
#include "utils/date.hpp"
910
#include "utils/file.hpp"
1011
#include "utils/version.hpp"
1112
#include <csignal>
@@ -31,7 +32,10 @@ void RunWithConfig(Config &config) {
3132
ProcessCtrl::Guard(
3233
[&exit_time](int exit_code, bool is_normal_exit) -> bool {
3334
exit_time++;
34-
File::Write("server.exit", to_string(exit_time));
35+
File::Write("server.exit", to_string(exit_time) + ", last time at " +
36+
Date::GetNow() + " exit_code " +
37+
to_string(exit_code) + " is_normal " +
38+
to_string(is_normal_exit));
3539
if (!is_normal_exit) {
3640
cout << "child exit code:" << exit_code
3741
<< " not normal exit:" << is_normal_exit << endl;

src/cppnet/ssl/ssl_context.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ std::shared_ptr<SSLSocket> SSLContext::AcceptSSL(const Socket &soc,
191191
auto rc = SSL_accept(new_ssl);
192192
if (rc < 0) {
193193
err_msg_ = std::string("[syserr]:ssl accept failed ") +
194-
ERR_error_string(ERR_get_error(), nullptr) + std::to_string(rc);
194+
ERR_error_string(ERR_get_error(), nullptr) + " rc " +
195+
std::to_string(rc);
195196
SSL_free(new_ssl);
196197
ERR_clear_error();
197198
return nullptr;

0 commit comments

Comments
 (0)