mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Improve logging of sessions.
This commit is contained in:
parent
e24a077752
commit
988c6bc433
23
cmd-find.c
23
cmd-find.c
@ -83,6 +83,7 @@ cmd_find_try_TMUX(struct client *c)
|
|||||||
char tmp[256];
|
char tmp[256];
|
||||||
long long pid;
|
long long pid;
|
||||||
u_int session;
|
u_int session;
|
||||||
|
struct session *s;
|
||||||
|
|
||||||
envent = environ_find(c->environ, "TMUX");
|
envent = environ_find(c->environ, "TMUX");
|
||||||
if (envent == NULL)
|
if (envent == NULL)
|
||||||
@ -92,8 +93,13 @@ cmd_find_try_TMUX(struct client *c)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
if (pid != getpid())
|
if (pid != getpid())
|
||||||
return (NULL);
|
return (NULL);
|
||||||
log_debug("client %p TMUX %s (session @%u)", c, envent->value, session);
|
log_debug("%s: client %p TMUX %s (session $%u)", __func__, c,
|
||||||
return (session_find_by_id(session));
|
envent->value, session);
|
||||||
|
|
||||||
|
s = session_find_by_id(session);
|
||||||
|
if (s != NULL)
|
||||||
|
log_debug("%s: session $%u still exists", __func__, s->id);
|
||||||
|
return (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find pane containing client if any. */
|
/* Find pane containing client if any. */
|
||||||
@ -109,6 +115,8 @@ cmd_find_inside_pane(struct client *c)
|
|||||||
if (strcmp(wp->tty, c->ttyname) == 0)
|
if (strcmp(wp->tty, c->ttyname) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (wp != NULL)
|
||||||
|
log_debug("%s: got pane %%%u (%s)", __func__, wp->id, wp->tty);
|
||||||
return (wp);
|
return (wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +175,8 @@ cmd_find_best_session(struct session **slist, u_int ssize, int flags)
|
|||||||
struct session *s_loop, *s;
|
struct session *s_loop, *s;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
|
log_debug("%s: %u sessions to try", __func__, ssize);
|
||||||
|
|
||||||
s = NULL;
|
s = NULL;
|
||||||
if (slist != NULL) {
|
if (slist != NULL) {
|
||||||
for (i = 0; i < ssize; i++) {
|
for (i = 0; i < ssize; i++) {
|
||||||
@ -190,6 +200,8 @@ cmd_find_best_session_with_window(struct cmd_find_state *fs)
|
|||||||
u_int ssize;
|
u_int ssize;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
|
|
||||||
|
log_debug("%s: window is @%u", __func__, fs->w->id);
|
||||||
|
|
||||||
ssize = 0;
|
ssize = 0;
|
||||||
RB_FOREACH(s, sessions, &sessions) {
|
RB_FOREACH(s, sessions, &sessions) {
|
||||||
if (!session_has(s, fs->w))
|
if (!session_has(s, fs->w))
|
||||||
@ -219,6 +231,8 @@ cmd_find_best_winlink_with_window(struct cmd_find_state *fs)
|
|||||||
{
|
{
|
||||||
struct winlink *wl, *wl_loop;
|
struct winlink *wl, *wl_loop;
|
||||||
|
|
||||||
|
log_debug("%s: window is @%u", __func__, fs->w->id);
|
||||||
|
|
||||||
wl = NULL;
|
wl = NULL;
|
||||||
if (fs->s->curw != NULL && fs->s->curw->window == fs->w)
|
if (fs->s->curw != NULL && fs->s->curw->window == fs->w)
|
||||||
wl = fs->s->curw;
|
wl = fs->s->curw;
|
||||||
@ -706,7 +720,7 @@ void
|
|||||||
cmd_find_log_state(const char *prefix, struct cmd_find_state *fs)
|
cmd_find_log_state(const char *prefix, struct cmd_find_state *fs)
|
||||||
{
|
{
|
||||||
if (fs->s != NULL)
|
if (fs->s != NULL)
|
||||||
log_debug("%s: s=$%u", prefix, fs->s->id);
|
log_debug("%s: s=$%u %s", prefix, fs->s->id, fs->s->name);
|
||||||
else
|
else
|
||||||
log_debug("%s: s=none", prefix);
|
log_debug("%s: s=none", prefix);
|
||||||
if (fs->wl != NULL) {
|
if (fs->wl != NULL) {
|
||||||
@ -895,6 +909,9 @@ cmd_find_from_client(struct cmd_find_state *fs, struct client *c, int flags)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (wl != NULL) {
|
if (wl != NULL) {
|
||||||
|
log_debug("%s: session $%u has pane %%%u", __func__,
|
||||||
|
s->id, wp->id);
|
||||||
|
|
||||||
fs->s = s;
|
fs->s = s;
|
||||||
fs->wl = s->curw; /* use current session */
|
fs->wl = s->curw; /* use current session */
|
||||||
fs->w = fs->wl->window;
|
fs->w = fs->wl->window;
|
||||||
|
@ -291,9 +291,10 @@ session_update_activity(struct session *s, struct timeval *from)
|
|||||||
else
|
else
|
||||||
memcpy(&s->activity_time, from, sizeof s->activity_time);
|
memcpy(&s->activity_time, from, sizeof s->activity_time);
|
||||||
|
|
||||||
log_debug("session %s activity %lld.%06d (last %lld.%06d)", s->name,
|
log_debug("session $%u %s activity %lld.%06d (last %lld.%06d)", s->id,
|
||||||
(long long)s->activity_time.tv_sec, (int)s->activity_time.tv_usec,
|
s->name, (long long)s->activity_time.tv_sec,
|
||||||
(long long)last->tv_sec, (int)last->tv_usec);
|
(int)s->activity_time.tv_usec, (long long)last->tv_sec,
|
||||||
|
(int)last->tv_usec);
|
||||||
|
|
||||||
if (evtimer_initialized(&s->lock_timer))
|
if (evtimer_initialized(&s->lock_timer))
|
||||||
evtimer_del(&s->lock_timer);
|
evtimer_del(&s->lock_timer);
|
||||||
|
Loading…
Reference in New Issue
Block a user