diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c index b14386c55e5280bb7e23415a9d29da58205db3a3..66f3d1d515371b8564d43d3430b56770abf670ee 100644 --- a/src/xpdev/ini_file.c +++ b/src/xpdev/ini_file.c @@ -61,6 +61,13 @@ void iniSetDefaultStyle(ini_style_t style) default_style = style; } +char* log_levels[] = {"Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Info", "Debug", NULL}; + +str_list_t iniLogLevelStringList(void) +{ + return(log_levels); +} + static char* section_name(char* p) { char* tp; diff --git a/src/xpdev/ini_file.h b/src/xpdev/ini_file.h index 262b06b08f2624b77480d71dbb9375f203200ae0..9f1f66a867f35530306c0ffa9ec2c2089d1a44f3 100644 --- a/src/xpdev/ini_file.h +++ b/src/xpdev/ini_file.h @@ -70,6 +70,9 @@ str_list_t iniReadKeyList(FILE*, const char* section); named_string_t** iniReadNamedStringList(FILE*, const char* section); +/* Return the supported Log Levels in a string list - for *LogLevel macros */ +str_list_t iniLogLevelStringList(void); + /* These functions read a single key of the specified type */ char* iniReadString(FILE*, const char* section, const char* key ,const char* deflt, char* value); @@ -99,6 +102,7 @@ double iniReadNamedFloat(FILE*, const char* section, const char* key ,named_double_t*, double deflt); ulong iniReadBitField(FILE*, const char* section, const char* key ,ini_bitdesc_t* bitdesc, ulong deflt); +#define iniReadLogLevel(f,s,k,d) iniReadEnum(f,s,k,iniLogLevelStringList(),d) /* Free string list returned from iniRead*List functions */ void* iniFreeStringList(str_list_t list); @@ -149,6 +153,7 @@ double iniGetNamedFloat(str_list_t, const char* section, const char* key ,named_double_t*, double deflt); ulong iniGetBitField(str_list_t, const char* section, const char* key ,ini_bitdesc_t* bitdesc, ulong deflt); +#define iniGetLogLevel(l,s,k,d) iniGetEnum(l,s,k,iniLogLevelStringList(),d) void iniSetDefaultStyle(ini_style_t); @@ -182,6 +187,7 @@ char* iniSetBitField(str_list_t*, const char* section, const char* key, ini_bit ,ini_style_t*); char* iniSetStringList(str_list_t*, const char* section, const char* key ,const char* sep, str_list_t value, ini_style_t*); +#define iniSetLogLevel(l,s,k,v,style) iniSetEnum(l,s,k,iniLogLevelStringList(),v,style) size_t iniAddSection(str_list_t*, const char* section ,ini_style_t*);