14 #include <fc_config.h>
27 #include <readline/readline.h>
41 static QString log_prefix();
42 static QtMessageHandler original_handler =
nullptr;
47 static void console_handle_message(QtMsgType type,
48 const QMessageLogContext &context,
52 if (type == QtCriticalMsg) {
56 }
else if (type == QtFatalMsg) {
60 pconn->send_buffer->do_buffer_sends = 0;
61 pconn->compression.frozen_level = 0;
68 _(
"Please report this message at %s"), BUG_URL);
71 if (original_handler !=
nullptr) {
72 original_handler(type, context, log_prefix() +
message);
90 rl_forced_update_display();
100 static QString log_prefix()
117 original_handler = qInstallMessageHandler(console_handle_message);
208 static bool first =
true;
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
void con_log_init(const QString &log_filename)
Initialize logging via console.
void con_prompt_off()
Do not print a prompt after log messages.
void con_flush()
Ensure timely update.
static bool console_rfcstyle
static bool console_prompt_is_showing
void con_log_close()
Deinitialize logging.
void con_set_style(bool i)
Set style.
void con_prompt_init()
Initialize prompt; display initial message.
static void con_update_prompt()
Print the prompt if it is not the last thing printed.
static bool readline_received_enter
void con_write(enum rfc_status rfc_status, const char *message,...)
Write to console and add line-break, and show prompt if required.
bool con_get_style()
Returns rfc-style.
void con_prompt_enter()
User pressed enter: will need a new prompt.
void con_puts(enum rfc_status rfc_status, const char *str)
Write to console and add line-break, and show prompt if required.
void con_set_color(const char *col)
static bool console_show_prompt
#define MAX_LEN_CONSOLE_LINE
void backtrace_init()
Take backtrace log callback to use.
void backtrace_deinit()
Remove backtrace log callback from use.
size_t featured_text_to_plain_text(const char *featured_text, char *plain_text, size_t plain_text_len, struct text_tag_list **tags, bool replace_link_text)
Separate the text from the text features.
const struct ft_color ftc_warning
void log_set_file(const QString &path)
Redirects the log to a file.
void log_close()
Deinitialize logging module.
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
See notify_conn_packet - this is just the "non-v" version, with varargs.
struct conn_list * est_connections
struct packet_game_info info
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)