Print logging and debugging messages to stderr

pull/541/head
Tom Thorogood 2021-04-02 23:09:26 +10:30
rodzic ccce555c63
commit 0c4fbb7ed9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 86C63CDA416C6D2F
3 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -72,7 +72,7 @@ void LOG(uint32_t tag, const char * filename, int num, const char * fmt, ...)
{
if (tag & tagtable[i].tagn)
{
if (tagtable[i].tag[0] && !(tag & TAG_NO_TAG)) printf("[%s] ", tagtable[i].tag);
if (tagtable[i].tag[0] && !(tag & TAG_NO_TAG)) fprintf(stderr, "[%s] ", tagtable[i].tag);
i = 0;
break;
}
@ -86,12 +86,12 @@ void LOG(uint32_t tag, const char * filename, int num, const char * fmt, ...)
#ifdef ENABLE_FILE_LOGGING
if (tag & TAG_FILENO)
{
printf("%s:%d: ", filename, num);
fprintf(stderr, "%s:%d: ", filename, num);
}
#endif
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
vfprintf(stderr, fmt, args);
va_end(args);
}

Wyświetl plik

@ -11,7 +11,7 @@ void dump_hex(uint8_t * buf, int size)
{
while(size--)
{
printf("%02x ", *buf++);
fprintf(stderr, "%02x ", *buf++);
}
printf("\n");
fprintf(stderr, "\n");
}

Wyświetl plik

@ -202,7 +202,7 @@ void usbhid_close()
void int_handler(int i)
{
usbhid_close();
printf("SIGINT... exiting.\n");
fprintf(stderr, "SIGINT... exiting.\n");
exit(0);
}
@ -364,7 +364,7 @@ void authenticator_initialize()
uint8_t * mem;
if (access(state_file, F_OK) != -1)
{
printf("state file exists\n");
fprintf(stderr, "state file exists\n");
f = fopen(state_file, "rb");
if (f== NULL)
{
@ -398,7 +398,7 @@ void authenticator_initialize()
}
else
{
printf("state file does not exist, creating it\n");
fprintf(stderr, "state file does not exist, creating it\n");
f = fopen(state_file, "wb+");
if (f== NULL)
{