52 linhas
949 B
C++
52 linhas
949 B
C++
/** Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License */
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
|
|
#include "logoutput.h"
|
|
|
|
namespace cura {
|
|
|
|
static int verbose_level;
|
|
static bool progressLogging;
|
|
|
|
void increaseVerboseLevel()
|
|
{
|
|
verbose_level++;
|
|
}
|
|
|
|
void enableProgressLogging()
|
|
{
|
|
progressLogging = true;
|
|
}
|
|
|
|
void logError(const char* fmt, ...)
|
|
{
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
vfprintf(stderr, fmt, args);
|
|
va_end(args);
|
|
fflush(stderr);
|
|
}
|
|
|
|
void log(const char* fmt, ...)
|
|
{
|
|
if (verbose_level < 1)
|
|
return;
|
|
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
vfprintf(stderr, fmt, args);
|
|
va_end(args);
|
|
fflush(stderr);
|
|
}
|
|
void logProgress(const char* type, int value, int maxValue)
|
|
{
|
|
if (!progressLogging)
|
|
return;
|
|
|
|
fprintf(stderr, "Progress:%s:%i:%i\n", type, value, maxValue);
|
|
fflush(stderr);
|
|
}
|
|
|
|
}//namespace cura
|