mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Cleanup log code
This commit is contained in:
parent
c82b7e2ecc
commit
4c611e6767
3 changed files with 35 additions and 14 deletions
19
src/tty.c
19
src/tty.c
|
|
@ -82,11 +82,15 @@ static unsigned char hex_char_index = 0;
|
|||
static void optional_local_echo(char c)
|
||||
{
|
||||
if (!option.local_echo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
print(c);
|
||||
fflush(stdout);
|
||||
if (option.log)
|
||||
log_write(c);
|
||||
{
|
||||
log_putc(c);
|
||||
}
|
||||
}
|
||||
|
||||
inline static bool is_valid_hex(char c)
|
||||
|
|
@ -794,14 +798,7 @@ int tty_connect(void)
|
|||
ansi_printf_raw("[%s] ", now);
|
||||
if (option.log)
|
||||
{
|
||||
log_write('[');
|
||||
while (*now != '\0')
|
||||
{
|
||||
log_write(*now);
|
||||
++now;
|
||||
}
|
||||
log_write(']');
|
||||
log_write(' ');
|
||||
log_printf("[%s] ", now);
|
||||
}
|
||||
next_timestamp = false;
|
||||
}
|
||||
|
|
@ -823,7 +820,9 @@ int tty_connect(void)
|
|||
|
||||
/* Write to log */
|
||||
if (option.log)
|
||||
log_write(input_char);
|
||||
{
|
||||
log_putc(input_char);
|
||||
}
|
||||
|
||||
socket_write(input_char);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue