Commit fba8d177 authored by cRTrn13's avatar cRTrn13

removed logging.c

parent edb6d0cb
#include <string.h>
#include "logging.h"
const uint32_t master_mask = 0xffff; // this is only temporary
char out[512];
#define HEX_PRINT(X,Y) { int zz; for(zz = 0; zz < Y; zz++) fprintf(stderr, "%02X", X[zz]); fprintf(stderr, "\n"); }
char *print_hex(uint8_t *buf, int count)
{
memset(out, 0, count);
int zz;
for(zz = 0; zz < count; zz++) {
sprintf(out + (zz * 2), "%02X", buf[zz]);
}
return out;
}
void debug(char *file, int line, uint32_t mask, const char *format, ...)
{
uint32_t type = (mask & master_mask) & 0xfffe,
verbose = !((!(master_mask & 1)) & (mask & 1));
if (type && verbose) {
char buffer[512];
va_list args;
va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
fprintf(stderr, "%s:%d: %s", file, line, buffer);
}
}
......@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#define DEBUG(X,Y,...) debug(__FILE__,__LINE__,X,Y,##__VA_ARGS__)
......@@ -17,7 +18,40 @@ enum {
DBG_BLURAY = 64
} debug_mask;
const uint32_t master_mask = 0xffff; // this is only temporary
char out[512];
char *print_hex(uint8_t *str, int count);
void debug(char *file, int line, uint32_t mask, const char *format, ...);
char *print_hex(uint8_t *buf, int count)
{
memset(out, 0, count);
int zz;
for(zz = 0; zz < count; zz++) {
sprintf(out + (zz * 2), "%02X", buf[zz]);
}
return out;
}
void debug(char *file, int line, uint32_t mask, const char *format, ...)
{
uint32_t type = (mask & master_mask) & 0xfffe,
verbose = !((!(master_mask & 1)) & (mask & 1));
if (type && verbose) {
char buffer[512];
va_list args;
va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
fprintf(stderr, "%s:%d: %s", file, line, buffer);
}
}
#endif /* LOGGING_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment