mirror of https://github.com/yandex/odyssey.git
odissey: implement log_session
This commit is contained in:
parent
5ef13a92e1
commit
fa5a5e4641
|
@ -9,6 +9,7 @@
|
|||
# log_file "./odissey.log"
|
||||
log_config yes
|
||||
log_debug yes
|
||||
log_session yes
|
||||
log_statistics 3
|
||||
readahead 8192
|
||||
pipelining 16384
|
||||
|
|
|
@ -321,10 +321,13 @@ int od_backend_connect(od_server_t *server)
|
|||
if (rc == -1)
|
||||
return -1;
|
||||
|
||||
od_log_server(&instance->log, &server->id, NULL,
|
||||
"new server connection %s:%d",
|
||||
server_scheme->host,
|
||||
server_scheme->port);
|
||||
/* log server connection */
|
||||
if (instance->scheme.log_session) {
|
||||
od_log_server(&instance->log, &server->id, NULL,
|
||||
"new server connection %s:%d",
|
||||
server_scheme->host,
|
||||
server_scheme->port);
|
||||
}
|
||||
|
||||
/* send startup and do initial configuration */
|
||||
rc = od_backend_startup(server);
|
||||
|
|
|
@ -56,7 +56,7 @@ int od_cancel(od_system_t *system,
|
|||
{
|
||||
od_instance_t *instance = system->instance;
|
||||
od_log_server(&instance->log, 0, "cancel",
|
||||
"new cancel for s%.*s", sizeof(server_id->id),
|
||||
"cancel for s%.*s", sizeof(server_id->id),
|
||||
server_id->id);
|
||||
od_server_t server;
|
||||
od_server_init(&server);
|
||||
|
|
|
@ -41,6 +41,7 @@ static od_keyword_t od_config_keywords[] =
|
|||
od_keyword("daemonize", OD_LDAEMONIZE),
|
||||
od_keyword("log_debug", OD_LLOG_DEBUG),
|
||||
od_keyword("log_config", OD_LLOG_CONFIG),
|
||||
od_keyword("log_session", OD_LLOG_SESSION),
|
||||
od_keyword("log_file", OD_LLOG_FILE),
|
||||
od_keyword("log_statistics", OD_LLOG_STATISTICS),
|
||||
od_keyword("pid_file", OD_LPID_FILE),
|
||||
|
@ -583,6 +584,13 @@ od_config_parse(od_config_t *config)
|
|||
return -1;
|
||||
config->scheme->log_config = rc;
|
||||
continue;
|
||||
/* log_session */
|
||||
case OD_LLOG_SESSION:
|
||||
rc = od_config_next_yes_no(config, &tk);
|
||||
if (rc == -1)
|
||||
return -1;
|
||||
config->scheme->log_session = rc;
|
||||
continue;
|
||||
/* log_file */
|
||||
case OD_LLOG_FILE:
|
||||
if (od_config_next(config, OD_LSTRING, &tk) == -1)
|
||||
|
|
|
@ -16,6 +16,7 @@ enum
|
|||
OD_LDAEMONIZE,
|
||||
OD_LLOG_DEBUG,
|
||||
OD_LLOG_CONFIG,
|
||||
OD_LLOG_SESSION,
|
||||
OD_LLOG_STATISTICS,
|
||||
OD_LLOG_FILE,
|
||||
OD_LPID_FILE,
|
||||
|
|
|
@ -485,11 +485,14 @@ void od_frontend(void *arg)
|
|||
od_client_t *client = arg;
|
||||
od_instance_t *instance = client->system->instance;
|
||||
|
||||
char peer[128];
|
||||
od_getpeername(client->io, peer, sizeof(peer));
|
||||
od_log_client(&instance->log, &client->id, NULL,
|
||||
"new client connection %s",
|
||||
peer);
|
||||
/* log client connection */
|
||||
if (instance->scheme.log_session) {
|
||||
char peer[128];
|
||||
od_getpeername(client->io, peer, sizeof(peer));
|
||||
od_log_client(&instance->log, &client->id, NULL,
|
||||
"new client connection %s",
|
||||
peer);
|
||||
}
|
||||
|
||||
/* attach client io to relay machine event loop */
|
||||
int rc;
|
||||
|
@ -620,8 +623,10 @@ void od_frontend(void *arg)
|
|||
|
||||
case OD_RS_OK:
|
||||
/* graceful disconnect */
|
||||
od_log_client(&instance->log, &client->id, NULL,
|
||||
"disconnected");
|
||||
if (instance->scheme.log_session) {
|
||||
od_log_client(&instance->log, &client->id, NULL,
|
||||
"disconnected");
|
||||
}
|
||||
if (! client->server) {
|
||||
od_unroute(client);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue