/*
 * logger.h
 *
 *  Created on: Feb 3, 2016
 *      Author: Philipp Hinz
 */

#ifndef LOGGER_H_
#define LOGGER_H_

// Logtypes for coloring

typedef enum {
	LOG_INFO = 0,
	LOG_CAN = 1,
	LOG_OK = 2,
	LOG_WARN = 3,
	LOG_ERROR = 4,
	LOG_ERRORC = 5,
} logger_type_t;

// verbosity levels

typedef enum {
	V_NONE = 0,
	V_BASIC = 1,
	V_BREW = 2,
	V_HAL = 3,
	V_SQL = 4,
	V_STRIPE = 5,
	V_SPI = 6,
} logger_verbose_t;


// Colors \o/
#define USE_COLORS

// List of escape sequences http://ascii-table.com/ansi-escape-sequences.php

#ifdef USE_COLORS
#define KNRM  "\x1B[0m"
#define KRED  "\x1B[31m"
#define KGRN  "\x1B[32m"
#define KYEL  "\x1B[33m"
#define KBLU  "\x1B[34m"
#define KMAG  "\x1B[35m"
#define KCYN  "\x1B[36m"
#define KWHT  "\x1B[37m"
#else
#define KNRM
#define KRED
#define KGRN
#define KYEL
#define KBLU
#define KMAG
#define KCYN
#define KWHT
#endif

#define CLEARLINE "\x1B[100D\x1B[1A\x1B[K"
#define KBOLD  "\x1B[1m"

void logger_error( const char* format, ... );
void logger_reset();
void logger(logger_verbose_t verboselevel, logger_type_t logtype, const char* format, ... );
void logger(logger_verbose_t verboselevel, const char* format, ... );

#endif /* LOGGER_H_ */
