From ca6ec930dca435ad24995976934869ab1d4021fe Mon Sep 17 00:00:00 2001 From: Raphix Date: Sat, 21 Oct 2023 17:23:33 +0200 Subject: [PATCH] Version 1.2.0 - Adding ReadMe --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ basics.js | 8 +++++--- main.js | 4 ++-- package.json | 4 ++-- 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e7757d8 --- /dev/null +++ b/README.md @@ -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") + +``` \ No newline at end of file diff --git a/basics.js b/basics.js index ad4af36..b331fcb 100644 --- a/basics.js +++ b/basics.js @@ -1,22 +1,23 @@ 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) - } + } if(date.getDate() + 1 <= 10) { gday = "0" + date.getDate() @@ -44,6 +45,7 @@ module.exports.getDate = function (formated) { } + module.exports.checkLogsDirectory = () => { if(!fs.existsSync(__dirname + path.sep + "logs" + path.sep)) { diff --git a/main.js b/main.js index 661ec9b..6208f9e 100644 --- a/main.js +++ b/main.js @@ -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 { diff --git a/package.json b/package.json index d041f9b..5002ef9 100644 --- a/package.json +++ b/package.json @@ -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"