Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFormerLurker <hochgebe@gmail.com>2021-07-06 02:57:33 +0300
committerFormerLurker <hochgebe@gmail.com>2021-07-06 02:57:33 +0300
commit9d3361e145c806a2ea0d3c7f1f6fc7252e4d0ef1 (patch)
tree52de3bf32785619982801e542c4121908916d145 /GcodeProcessorLib
parentb2e44aa85c9da175c6e78fd909c9f92531f5f393 (diff)
Add alpha gcode length restrictions. Enhance output statistics. Create arc_welder_args. Add new progress type args to command line processor.
Diffstat (limited to 'GcodeProcessorLib')
-rw-r--r--GcodeProcessorLib/logger.cpp14
-rw-r--r--GcodeProcessorLib/logger.h5
-rw-r--r--GcodeProcessorLib/utilities.cpp2
-rw-r--r--GcodeProcessorLib/utilities.h1
4 files changed, 18 insertions, 4 deletions
diff --git a/GcodeProcessorLib/logger.cpp b/GcodeProcessorLib/logger.cpp
index 5b1e4eb..3bde18e 100644
--- a/GcodeProcessorLib/logger.cpp
+++ b/GcodeProcessorLib/logger.cpp
@@ -57,10 +57,24 @@ void logger::set_log_level_by_value(const int level_value)
logger_levels_[type_index] = log_level;
}
}
+
void logger::set_log_level(const int logger_type, const int log_level)
{
logger_levels_[logger_type] = log_level;
}
+std::string logger::get_log_level_name(std::string logger_name)
+{
+ std::string log_level_name = "UNKNOWN";
+ for (int type_index = 0; type_index < num_loggers_; type_index++)
+ {
+ if (logger_names_[type_index] == logger_name)
+ {
+ log_level_name = log_level_names[logger_levels_[type_index]];
+ break;
+ }
+ }
+ return log_level_name;
+}
void logger::set_log_level(const int log_level)
{
diff --git a/GcodeProcessorLib/logger.h b/GcodeProcessorLib/logger.h
index 9db2df1..f345097 100644
--- a/GcodeProcessorLib/logger.h
+++ b/GcodeProcessorLib/logger.h
@@ -36,7 +36,7 @@ enum log_levels { NOSET, VERBOSE, DEBUG, INFO, WARNING , ERROR, CRITICAL};
static const int log_level_names_size = 7;
static const char* log_level_names[] = {"NOSET", "VERBOSE", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"};
const static int log_level_values[LOG_LEVEL_COUNT] = { 0, 5, 10, 20, 30, 40, 50};
-
+#define DEFAULT_LOG_LEVEL_VALUE 40
class logger
{
public:
@@ -48,7 +48,8 @@ public:
void set_log_level(const int logger_type, const int log_level);
void set_log_level(const int log_level);
-
+
+ std::string get_log_level_name(std::string logger_name);
virtual void log(const int logger_type, const int log_level, const std::string& message);
virtual void log(const int logger_type, const int log_level, const std::string& message, bool is_exception);
virtual void log_exception(const int logger_type, const std::string& message);
diff --git a/GcodeProcessorLib/utilities.cpp b/GcodeProcessorLib/utilities.cpp
index a723cdf..4db0f6a 100644
--- a/GcodeProcessorLib/utilities.cpp
+++ b/GcodeProcessorLib/utilities.cpp
@@ -217,7 +217,7 @@ int utilities::get_num_digits(int x)
(x < 10000000 ? 7 :
(x < 100000000 ? 8 :
(x < 1000000000 ? 9 :
- 10)))))))));
+ (x < 10000000000 ? 10 : -1))))))))));
}
int utilities::get_num_digits(double x)
diff --git a/GcodeProcessorLib/utilities.h b/GcodeProcessorLib/utilities.h
index acbea6c..3261f91 100644
--- a/GcodeProcessorLib/utilities.h
+++ b/GcodeProcessorLib/utilities.h
@@ -55,7 +55,6 @@ public:
static double get_percent_change(int v1, int v2);
static double get_percent_change(double v1, double v2);
static std::string get_percent_change_string(int v1, int v2, int precision);
-
static int get_num_digits(int x);
static int get_num_digits(double x);