@lex0u/logger
v1.2.3
Published
Logger complet et universel (Typescript)
Downloads
45
Maintainers
Readme
@lex0u/logger
🚀 Installation
npm install @lex0u/logger⚡ Quick Start
import { Logger, LogLevel } from '@lex0u/logger';
const logger = new Logger({
console: {
enabled: true,
minLevel: LogLevel.Debug,
},
file: {
enabled: true,
folderPath: './logs',
},
});
await logger.log(LogLevel.Information, "Serveur démarré", "App");
await logger.log(LogLevel.Error, "Connexion échouée", "DB", { host: "localhost" });
// Sortie ciblée
await logger.log.console(LogLevel.Debug, "Debug uniquement console", "Auth");
await logger.log.file(LogLevel.Warning, "Warning uniquement fichier", "API");💬 Intégration Discord
import { Logger, LogLevel } from '@lex0u/logger';
import { Client, GatewayIntentBits } from 'discord.js';
const logger = new Logger({
console: { enabled: true },
discord: {
enabled: true,
minLevel: LogLevel.Warning,
destination: {
guildId: "...",
channel: "..."
},
},
});
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once("ready", () => {
logger.setDiscordClient(client);
});
client.login(process.env.DISCORD_TOKEN);🧠 Log Levels
LogLevel.Debug
LogLevel.Information
LogLevel.Warning
LogLevel.Error✨ Features
- ✅ Console logging
- ✅ File logging
- ✅ Discord logging
- ✅ Async API
- ✅ Metadata support
- ✅ Per-destination log level
- ✅ Queue system for Discord
- ✅ Fully typed (TypeScript)
🛠 Scripts
npm run build
npm run test
npm run dev🤝 Contribution
Les contributions sont les bienvenues !
Workflow
# Fork
git clone https://github.com/lex0u/logger.git
# Install
npm install
# Dev
npm run devGuidelines
- Utiliser TypeScript strict
- Respecter l’architecture existante
- Commits clairs (
feat:,fix:,refactor:) - Pull Request descriptive
📦 Roadmap
- [ ] Rotation automatique des fichiers
- [ ] Format custom
- [ ] Webhook support
- [ ] Logger middleware Express
- [ ] Benchmarks
📄 Licence
MIT © 2026 Lex0u
⭐ Support
Si le projet t’aide, laisse une ⭐ sur GitHub !
