https://github.com/d3rhase/jlogger
Lightweight, easy-to-use java logging-libary
https://github.com/d3rhase/jlogger
easy-to-use java java-11 lightweight logging logging-library
Last synced: about 1 year ago
JSON representation
Lightweight, easy-to-use java logging-libary
- Host: GitHub
- URL: https://github.com/d3rhase/jlogger
- Owner: D3rHase
- License: bsd-3-clause
- Created: 2022-06-09T15:25:58.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-15T19:29:08.000Z (about 3 years ago)
- Last Synced: 2025-02-17T05:57:30.590Z (over 1 year ago)
- Topics: easy-to-use, java, java-11, lightweight, logging, logging-library
- Language: Java
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jLogger - v1.1.1
[](https://jitpack.io/#D3rHase/jLogger)
A lightweight easy-to-use java logging libary.
## Usage
**1. Step**: Add the dependency to your `pom.xml`
```xml
jitpack.io
https://jitpack.io
```
```xml
com.github.D3rHase
jLogger
1.1.1
```
**2. Step**: Enjoy your new logger:
```java
package com.example;
import de.d3rhase.interfaces.Logger;
import de.d3rhase.txtlogger.TxtLogger;
public class Class {
public Logger logger;
public Class() {
this.logger = new Logger(, , );
this.logger.error(, , );
}
}
```
## Examples
### 1. TXT-Logger
```java
public Class() {
this.logger = new TxtLogger(, , );
this.logger.ok(, , );
this.logger.info(, , );
this.logger.debug(, , );
this.logger.warning(, , );
this.logger.error(, , );
}
}
```
#### Terminal:
```
OK - 2022.06.11 - 21:13:54.5643998 - MODULE - text
INFO - 2022.06.11 - 21:13:54.5794125 - MODULE - text
DEBUG - 2022.06.11 - 21:13:54.5804134 - MODULE - text
WARNING - 2022.06.11 - 21:13:54.5814142 - MODULE - text
ERROR - 2022.06.11 - 21:13:54.5814142 - MODULE - text
```
#### Log-file (logTitle_log-2022-06-11__21-13-54.61.txt):
```
---- LOG - logTitle - Date: 2022-06-11__21-13-54.61 ----
OK - 2022.06.11 - 21:13:54.6124431 - MODULE - text
INFO - 2022.06.11 - 21:13:54.6124431 - MODULE - text
DEBUG - 2022.06.11 - 21:13:54.6134432 - MODULE - text
WARNING - 2022.06.11 - 21:13:54.6134432 - MODULE - text
ERROR - 2022.06.11 - 21:13:54.6134432 - MODULE - text
```
### 2. Json-Logger
```java
public Class() {
this.logger = new TxtLogger(, , );
this.logger.ok(, , );
this.logger.info(, , );
this.logger.debug(, , );
this.logger.warning(, , );
this.logger.error(, , );
}
}
```
#### Terminal:
```
OK - 2022.06.11 - 21:18:44.793586 - MODULE - text
INFO - 2022.06.11 - 21:18:44.793586 - MODULE - text
DEBUG - 2022.06.11 - 21:18:44.793586 - MODULE - text
WARNING - 2022.06.11 - 21:18:44.793586 - MODULE - text
ERROR - 2022.06.11 - 21:18:44.793586 - MODULE - text
```
#### Log-file (logTitle_log-2022-06-11__21-18-44.66.json):
```json
[
{
"date": "2022-06-11__21-18-44.66",
"category": "JsonLOG",
"title": "logTitle"
},
{
"module": "MODULE",
"time": "2022-06-11__21-18-44.7405379",
"text": "text",
"type": "OK"
},
{
"module": "MODULE",
"time": "2022-06-11__21-18-44.7575533",
"text": "text",
"type": "INFO"
},
{
"module": "MODULE",
"time": "2022-06-11__21-18-44.7575533",
"text": "text",
"type": "DEBUG"
},
{
"module": "MODULE",
"time": "2022-06-11__21-18-44.7585559",
"text": "text",
"type": "WARNING"
},
{
"module": "MODULE",
"time": "2022-06-11__21-18-44.7595561",
"text": "text",
"type": "ERROR"
}
]
```
### 3. TxtVLogger / JsonVLogger
```java
public Class() {
this.logger = new TxtVLogger(, , );
this.logger = new JsonVLogger(, , );
this.logger.ok(, , );
this.logger.info(, , );
this.logger.debug(, , );
this.logger.warning(, , );
this.logger.error(, , );
logger.saveLog();
}
}
```
#### Terminal:
[Same as the "normal" logger](https://github.com/D3rHase/jLogger#terminal-1)
#### Log-file:
Empty until `logger.savelog();` ist called.
### 4. TxtVErrorLogger / JsonVErrorLogger
```java
public Class() {
this.logger = new TxtVErrorLogger(, , );
this.logger = new JsonVErrorLogger(, , );
this.logger.ok(, , );
this.logger.info(, , );
this.logger.debug(, , );
this.logger.warning(, , );
this.logger.error(, , );
logger.saveLog();
}
}
```
#### Terminal:
[Same as the "normal" logger](https://github.com/D3rHase/jLogger#terminal-1)
#### Log-file:
[Empty](https://github.com/D3rHase/jLogger#log-file) until `logger.savelog();` ist called.
**OR** an error is added to the log.