blob: cb3a62ea7399bbe47eb4336733209df60a9e35fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* console.c
* Console log handler routines
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <stdio.h>
#include "epan/prefs.h"
#include "wsutil/time_util.h"
#include "console.h"
void
console_log_writer(const char *format, va_list ap,
const char *prefix, enum ws_log_domain domain _U_,
enum ws_log_level level _U_, void *ptr _U_)
{
gboolean fatal = level == LOG_LEVEL_ERROR;
#ifdef _WIN32
if (prefs.gui_console_open != console_open_never || fatal) {
/* the user wants a console or the application will terminate immediately */
create_console();
}
#else
(void)fatal;
#endif /* _WIN32 */
ws_log_fprint(stderr, format, ap, prefix);
#ifdef _WIN32
if (fatal) {
/* wait for a key press before the following error handler will terminate the program
this way the user at least can read the error message */
printf("\n\nPress any key to exit\n");
_getch();
}
#endif /* _WIN32 */
}
|