From cc3a1160e09586df7bf168dd9f39e313c9a717a9 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Wed, 29 Mar 2023 18:13:56 +0300 Subject: [PATCH] add aliases, fix calling the main object --- CHANGELOG.md | 10 ++++++++++ README.md | 19 ++++++++++--------- source/singlog.d | 10 +++++++++- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c2744..0ed29d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [v0.2.1](https://git.zhirov.kz/dlang/singlog/compare/v0.2.0...v0.2.1) (2023.03.29) + +### New + +- Added aliases for the short form of function calls + +### Bug fixes + +- Calling the main object + ## [v0.2.0](https://git.zhirov.kz/dlang/singlog/compare/v0.1.0...v0.2.0) (2023.03.29) - Removed functions `fileOn()` and `fileOff()` diff --git a/README.md b/README.md index dedb456..4ec6a2a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Singleton for simple logging ## Basic Usage ```d -import simplog; +import singlog; void main() { @@ -19,6 +19,7 @@ void main() log.output(log.SYSLOG | log.FILE); log.file("./file.log"); log.warning("Hello, World!"); + log.w("The same thing"); } ``` @@ -54,15 +55,15 @@ log.file("./file.log"); Output of messages to the log: ```d -log.alert("Alert message"); -log.critical("Critical message"); -log.error("Error message"); -log.warning("Warning message"); -log.notice("Notice message"); -log.informations("Information message"); -log.debugging("Debugging message"); +log.a("Alert message") => log.alert("Alert message"); +log.c("Critical message") => log.critical("Critical message"); +log.e("Error message") => log.error("Error message"); +log.w("Warning message") => log.warning("Warning message"); +log.n("Notice message") => log.notice("Notice message"); +log.i("Information message") => log.information("Information message"); +log.d("Debugging message") => log.debugging("Debugging message"); ``` ## Dub -Add a dependency on `"singlog": "~>0.2.0"`. +Add a dependency on `"singlog": "~>0.2.1"`. diff --git a/source/singlog.d b/source/singlog.d index df38390..52d316a 100644 --- a/source/singlog.d +++ b/source/singlog.d @@ -8,7 +8,7 @@ import std.file; import std.datetime; import datefmt; -alias log = log; +alias log = Log.msg; /++ Singleton for simple logging @@ -148,4 +148,12 @@ class Log void notice(T)(T message) { writeLog(message.to!string, NOTICE, LOG_NOTICE); } void information(T)(T message) { writeLog(message.to!string, INFO, LOG_INFO); } void debugging(T)(T message) {writeLog(message.to!string, DEBUG, LOG_DEBUG); } + + alias a = alert; + alias c = critical; + alias e = error; + alias w = warning; + alias n = notice; + alias i = information; + alias d = debugging; }