add aliases, fix calling the main object

This commit is contained in:
Alexander Zhirov 2023-03-29 18:13:56 +03:00
parent 7b6d13d9dc
commit cc3a1160e0
3 changed files with 29 additions and 10 deletions

View File

@ -1,5 +1,15 @@
# Changelog # 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) ## [v0.2.0](https://git.zhirov.kz/dlang/singlog/compare/v0.1.0...v0.2.0) (2023.03.29)
- Removed functions `fileOn()` and `fileOff()` - Removed functions `fileOn()` and `fileOff()`

View File

@ -10,7 +10,7 @@ Singleton for simple logging
## Basic Usage ## Basic Usage
```d ```d
import simplog; import singlog;
void main() void main()
{ {
@ -19,6 +19,7 @@ void main()
log.output(log.SYSLOG | log.FILE); log.output(log.SYSLOG | log.FILE);
log.file("./file.log"); log.file("./file.log");
log.warning("Hello, World!"); log.warning("Hello, World!");
log.w("The same thing");
} }
``` ```
@ -54,15 +55,15 @@ log.file("./file.log");
Output of messages to the log: Output of messages to the log:
```d ```d
log.alert("Alert message"); log.a("Alert message") => log.alert("Alert message");
log.critical("Critical message"); log.c("Critical message") => log.critical("Critical message");
log.error("Error message"); log.e("Error message") => log.error("Error message");
log.warning("Warning message"); log.w("Warning message") => log.warning("Warning message");
log.notice("Notice message"); log.n("Notice message") => log.notice("Notice message");
log.informations("Information message"); log.i("Information message") => log.information("Information message");
log.debugging("Debugging message"); log.d("Debugging message") => log.debugging("Debugging message");
``` ```
## Dub ## Dub
Add a dependency on `"singlog": "~>0.2.0"`. Add a dependency on `"singlog": "~>0.2.1"`.

View File

@ -8,7 +8,7 @@ import std.file;
import std.datetime; import std.datetime;
import datefmt; import datefmt;
alias log = log; alias log = Log.msg;
/++ /++
Singleton for simple logging Singleton for simple logging
@ -148,4 +148,12 @@ class Log
void notice(T)(T message) { writeLog(message.to!string, NOTICE, LOG_NOTICE); } 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 information(T)(T message) { writeLog(message.to!string, INFO, LOG_INFO); }
void debugging(T)(T message) {writeLog(message.to!string, DEBUG, LOG_DEBUG); } 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;
} }