parent
323ea03a45
commit
1368b271b0
|
@ -4,6 +4,11 @@
|
||||||
|
|
||||||
<h1 align="center">readconf</h1>
|
<h1 align="center">readconf</h1>
|
||||||
|
|
||||||
|
[![license](https://img.shields.io/github/license/AlexanderZhirov/readconf.svg?sort=semver&style=for-the-badge&color=green)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
|
||||||
|
[![main](https://img.shields.io/badge/dynamic/json.svg?label=git.zhirov.kz&style=for-the-badge&url=https://git.zhirov.kz/api/v1/repos/dlang/readconf/tags&query=$[0].name&color=violet)](https://git.zhirov.kz/dlang/readconf)
|
||||||
|
[![githab](https://img.shields.io/github/v/tag/AlexanderZhirov/readconf.svg?sort=semver&style=for-the-badge&color=blue&label=github)](https://github.com/AlexanderZhirov/readconf)
|
||||||
|
[![dub](https://img.shields.io/dub/v/readconf.svg?sort=semver&style=for-the-badge&color=orange)](https://code.dlang.org/packages/readconf)
|
||||||
|
|
||||||
Singleton for reading the configuration file required for your program.
|
Singleton for reading the configuration file required for your program.
|
||||||
|
|
||||||
## What can do
|
## What can do
|
||||||
|
|
2
dub.json
2
dub.json
|
@ -33,6 +33,6 @@
|
||||||
],
|
],
|
||||||
"targetName": "readconf",
|
"targetName": "readconf",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"singlog": "~>0.1.0"
|
"singlog": "~>0.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,6 @@
|
||||||
"versions": {
|
"versions": {
|
||||||
"datefmt": "1.0.4",
|
"datefmt": "1.0.4",
|
||||||
"silly": "1.1.1",
|
"silly": "1.1.1",
|
||||||
"singlog": "0.1.0"
|
"singlog": "0.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ private:
|
||||||
try {
|
try {
|
||||||
configuration = File(this.path, "r");
|
configuration = File(this.path, "r");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.msg.warning("Unable to open the configuration file " ~ this.path);
|
log.w("Unable to open the configuration file " ~ this.path);
|
||||||
Log.msg.error(e);
|
log.e(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ private:
|
||||||
configuration.close();
|
configuration.close();
|
||||||
this.readed = true;
|
this.readed = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.msg.warning("Unable to close the configuration file " ~ this.path);
|
log.w("Unable to close the configuration file " ~ this.path);
|
||||||
Log.msg.error(e);
|
log.e(e);
|
||||||
this.configs.remove(configName);
|
this.configs.remove(configName);
|
||||||
this.readed = false;
|
this.readed = false;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ struct ConfigSection
|
||||||
private void add(ConfigParameter parameter)
|
private void add(ConfigParameter parameter)
|
||||||
{
|
{
|
||||||
if (parameter.property in parameters)
|
if (parameter.property in parameters)
|
||||||
Log.msg.warning("The parameter exists but will be overwritten");
|
log.w("The parameter exists but will be overwritten");
|
||||||
this.parameters[parameter.property] = parameter;
|
this.parameters[parameter.property] = parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,8 +319,8 @@ struct ConfigParameter
|
||||||
try {
|
try {
|
||||||
return this.value.to!T;
|
return this.value.to!T;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.msg.warning("Cannot convert type");
|
log.w("Cannot convert type");
|
||||||
Log.msg.error(e);
|
log.e(e);
|
||||||
return T.init;
|
return T.init;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue