Version 1.2.0 - Adding ReadMe

This commit is contained in:
CICD - Pipeline 2023-10-21 17:23:33 +02:00
parent c3bb65e012
commit ca6ec930dc
4 changed files with 49 additions and 7 deletions

40
README.md Normal file
View File

@ -0,0 +1,40 @@
# Loguix
> Loguix est un petit package qui permet de générer des logs formatés : **[YYYY-MM-DD-hh-mm-ss]**
## Utilisation
> - Dès que vous instanciez le package, un dossier `./logs` est crée dans lequels les fichiers journaux vont s'ajouter
### Fonctions principales
```js
const MyLogSection = new LogType("Mon nom de section")
// Affiche une information
MyLogSection.log('.....')
// Affiche un avertissement
MyLogSection.warn('.....')
// Affiche une erreur
MyLogSection.error('.....')
```
### Etapes (Steps)
```js
const MyLogSection = new LogType("Mon nom de section")
// Affiche une information
MyLogSection.step.init('identifiant', ".....")
// Affiche un avertissement
MyLogSection.step.end('identifiant')
// Affiche une erreur
MyLogSection.step.error('identifiant', "Descritpion de l'erreur")
```

View File

@ -1,20 +1,21 @@
const fs = require("fs")
const path = require("path")
module.exports.getDate = function (formated) {
var date = new Date()
// [Date Format] - Format de la date
var gmonth = date.getMonth()
var gmonth = date.getMonth() + 1
var gday = date.getDate()
var gHour = date.getHours()
var gMinute = date.getMinutes()
var gSecondes = date.getSeconds()
if(date.getMonth() + 1 <= 10) {
if(date.getMonth() + 1 < 10) {
gmonth = "0" + (date.getMonth() + 1)
}
@ -44,6 +45,7 @@ module.exports.getDate = function (formated) {
}
module.exports.checkLogsDirectory = () => {
if(!fs.existsSync(__dirname + path.sep + "logs" + path.sep)) {

View File

@ -59,8 +59,8 @@ function setup() {
}
/**
* Déclare une nouvelle instance de log
* @param {string} typeName Indique le nom du type de log
* Déclare une nouvelle section
* @param {string} typeName Nom de la section associé
*/
module.exports.LogType = class {

View File

@ -1,7 +1,7 @@
{
"name": "loguix",
"version": "1.1.0",
"description": "Log System for JS",
"version": "1.2.0",
"description": "Systeme de journaux simplifié",
"main": "main.js",
"scripts": {
"debug": "node test.js"