Version 1.2.0 - Adding ReadMe
This commit is contained in:
		
							
								
								
									
										40
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								README.md
									
									
									
									
									
										Normal 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")
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
@@ -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)) { 
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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 {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user