#ifndef LOGGER_H_
#define LOGGER_H_

#include <stdbool.h>

#ifdef DEBUG
#define DEBUG_PRINT(fmt, args...)                                              \
  fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__,     \
          ##args)
#else
#define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */
#endif

#define LOG(component, fmt, args...) append_log("[%s] " fmt, component, ##args)

struct logger {
  struct nk_text_edit *text_edit;
  unsigned long box_lines;
  struct nk_scroll *scrollbar;
  bool extend_box;
  int font_height;
};

struct logger *setup_logger(void);

void append_log(const char *fmt, ...);

void clear_log();

#endif