sassy-log
Version:
Logging, but with sass, satire, and some serious fun. A developer-first NPM package that replaces boring console.log() statements with snarky, sarcastic, or corporate-smooth one-liners.
406 lines (296 loc) β’ 11 kB
Markdown
# π₯ sassy-log
**Logging, but with sass, satire, and some serious fun.**
[](https://www.npmjs.com/package/sassy-log)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
[](https://github.com/imankii01/sassy-log)
> *Created with β€οΈ by [imankii01](https://github.com/imankii01)*
## π§ What Is It?
**sassy-log** is a developer-first NPM package that replaces boring `console.log()` statements with snarky, sarcastic, or corporate-smooth one-liners. It's a lightweight wrapper around your standard logging that adds humor and flavor to everyday logs β turning your terminal into a place of laughter, roast, and personality.
Instead of this:
```javascript
console.log("User created")
```
You get:
```javascript
log.success("User created")
// => "β
Well, well, look who can CRUD. | Original: 'User created'"
```
## π‘ Why It Exists
Developers spend hours staring at logs β but logs are often dry, robotic, or completely emotionless. **sassy-log** injects life into the debugging process by making logs feel like a teammate β whether that's a sarcastic senior dev, an overly positive intern, or a corporate manager sugarcoating a failure.
This is more than just fun β it's:
- **A morale booster** for dev teams
- **A memory anchor** (you'll remember a funny log better)
- **A great way to differentiate environments** (prod = corporate, dev = savage)
- **Cross-platform compatible** (Windows, macOS, Linux, any terminal)
## π¦ Installation
```bash
npm install sassy-log
```
Or with yarn:
```bash
yarn add sassy-log
```
## π Quick Start
```javascript
const sassyLogger = require('sassy-log');
// Create a logger with your preferred personality
const log = sassyLogger({ mode: 'sarcastic' });
// Use it like console.log, but with personality
log('Data fetched');
// => "π¬ Oh great, more data you don't know what to do with. | Original: 'Data fetched'"
log.success('User updated');
// => "β
Well, would you look at that. It actually worked. | Original: 'User updated'"
log.warn('API deprecated');
// => "β οΈ Oh look, a warning. I'm sure you'll totally pay attention to this one. | Original: 'API deprecated'"
log.error('Server crashed');
// => "β Surprise! It's broken. Who could have seen this coming? | Original: 'Server crashed'"
```
## π― Core Modes
| Mode | Personality | Example |
|------|-------------|---------|
| **savage** | Brutally honest dev-style roasts | *"Congrats. You broke it. Again."* |
| **friendly** | Positive & cheerful | *"Oops! But you got this, champ πͺ"* |
| **sarcastic** | Passive-aggressive (default) | *"Oh wow, another null. Shocking."* |
| **corporate** | Polite and professional | *"A minor disruption was observed during execution."* |
## π οΈ Advanced Usage
### Configuration Options
```javascript
const log = sassyLogger({
mode: 'savage', // savage, friendly, sarcastic, corporate
colors: true, // Enable/disable colors (auto-detected)
timestamps: false, // Add timestamps to logs
emojis: true, // Enable/disable emojis
customQuotes: {} // Add your own quotes
});
```
### Mode Switching at Runtime
```javascript
const log = sassyLogger({ mode: 'friendly' });
log.info('Starting in friendly mode');
// => "π Hey there! Just keeping you in the loop!"
log.setMode('savage');
log.info('Now in savage mode');
// => "π¬ Oh great, more data you don't know what to do with."
// Check current mode
console.log(log.getMode()); // => "savage"
// See all available modes
console.log(log.getAvailableModes()); // => ["savage", "friendly", "sarcastic", "corporate"]
```
### Method Chaining
```javascript
const log = sassyLogger({ mode: 'sarcastic' });
log
.info('Starting process')
.success('Step 1 complete')
.warn('Step 2 has issues')
.error('Process failed')
.info('Retrying...');
```
### Custom Quotes
```javascript
const log = sassyLogger({ mode: 'savage' });
// Add your own sassy quotes
log.addCustomQuotes('savage', 'info', [
'Oh look, another "temporary" solution that will last forever.',
'Breaking: Your code did something. Medal ceremony at 3 PM.'
]);
log.info('Custom sass activated');
// => Might show one of your custom quotes!
```
### Environment-Based Configuration
```javascript
// Perfect for different environments
const log = sassyLogger({
mode: process.env.NODE_ENV === 'production' ? 'corporate' : 'savage',
colors: process.env.NODE_ENV !== 'production',
timestamps: process.env.NODE_ENV === 'production'
});
```
## π Platform Compatibility
**sassy-log** works everywhere JavaScript runs:
- β
**Node.js** (12.0.0+)
- β
**Windows** (CMD, PowerShell, Windows Terminal)
- β
**macOS** (Terminal, iTerm2)
- β
**Linux** (Any terminal)
- β
**CI/CD** (GitHub Actions, Travis, CircleCI, etc.)
- β
**VS Code** integrated terminal
- β
**Docker** containers
- β
**Serverless** functions
- β
**React/Next.js** (browser console)
- β
**Electron** apps
### Color Support
Colors are automatically detected and enabled when supported:
- β
Modern terminals (supports 256+ colors)
- β
VS Code, WebStorm, other IDEs
- β
CI environments with color support
- β Plain text environments (automatically disabled)
## π API Reference
### Main Methods
| Method | Description | Example |
|--------|-------------|---------|
| `log(msg?)` | Default info logging | `log('Hello')` |
| `info(msg?)` | Information logging | `log.info('Process started')` |
| `success(msg?)` | Success logging | `log.success('Task completed')` |
| `warn(msg?)` | Warning logging | `log.warn('Memory high')` |
| `error(msg?)` | Error logging | `log.error('Connection failed')` |
### Configuration Methods
| Method | Description | Returns |
|--------|-------------|---------|
| `setMode(mode)` | Change logging mode | `SassyLogger` |
| `getMode()` | Get current mode | `string` |
| `getAvailableModes()` | List all modes | `string[]` |
| `setColors(enabled)` | Toggle colors | `SassyLogger` |
| `setTimestamps(enabled)` | Toggle timestamps | `SassyLogger` |
| `setEmojis(enabled)` | Toggle emojis | `SassyLogger` |
| `addCustomQuotes(mode, type, quotes)` | Add custom quotes | `SassyLogger` |
## π¨ Examples in Action
### Express.js Middleware
```javascript
const express = require('express');
const sassyLogger = require('sassy-log');
const app = express();
const log = sassyLogger({ mode: 'sarcastic', timestamps: true });
app.use((req, res, next) => {
log.info(`${req.method} ${req.path}`);
next();
});
app.get('/', (req, res) => {
log.success('Home page served');
res.send('Hello World!');
});
app.listen(3000, () => {
log.success('Server running on port 3000');
});
```
### CLI Tool
```javascript
#!/usr/bin/env node
const sassyLogger = require('sassy-log');
const log = sassyLogger({ mode: 'friendly', colors: true });
async function deploy() {
log.info('Starting deployment...');
try {
// Deployment logic here
log.success('Deployment completed!');
} catch (error) {
log.error('Deployment failed');
process.exit(1);
}
}
deploy();
```
### React/Next.js (Browser)
```javascript
import sassyLogger from 'sassy-log';
const log = sassyLogger({
mode: 'savage',
colors: false, // Browser console handles colors differently
emojis: true
});
function MyComponent() {
useEffect(() => {
log.info('Component mounted');
return () => {
log.warn('Component unmounting');
};
}, []);
const handleClick = () => {
log.success('Button clicked');
};
return <button onClick={handleClick}>Click me</button>;
}
```
## π§ͺ Testing
Run the built-in tests:
```bash
# Basic functionality test
npm test
# See basic examples
npm run example
# See mode switching examples
npm run example-modes
```
## π§ TypeScript Support
Full TypeScript support is included:
```typescript
import sassyLogger, { SassyLoggerOptions, SassyLoggerInstance } from 'sassy-log';
const options: SassyLoggerOptions = {
mode: 'savage',
colors: true,
timestamps: false,
emojis: true
};
const log: SassyLoggerInstance = sassyLogger(options);
log.info('TypeScript works perfectly!');
```
## π€ Contributing
We love contributions! Here's how you can help make **sassy-log** even more awesome:
### Adding New Quotes
1. Fork the repository
2. Edit `lib/quotes.js`
3. Add your hilarious quotes to any mode
4. Submit a pull request
### Adding New Modes
Want to add a new personality mode?
1. Add your mode to `lib/quotes.js`
2. Update the TypeScript definitions
3. Add examples and tests
4. Submit a pull request
### Ideas for New Modes
- `desi` - Indian developer humor
- `gen-z` - Modern internet slang
- `shakespearean` - Olde English style
- `pirate` - Arrr, matey!
- `motivational` - Life coach vibes
## π Use Cases
- **Solo devs** who want logs that talk back
- **Dev teams** using humorous logs in pull requests or Slack threads
- **Startups** looking for playful internal tooling
- **CLI tools** that want personality
- **Internal dashboards** with fun notification logs
- **Learning projects** to make coding more enjoyable
- **Debugging sessions** that need some comic relief
## πΊοΈ Roadmap
- [ ] AI-powered roast generation using OpenAI/Gemini
- [ ] Plugin system for custom modes
- [ ] Log aggregation and analytics
- [ ] Slack/Discord webhook integration
- [ ] Voice output for the ultimate sass experience
- [ ] Custom emoji sets
- [ ] Log theming and styling options
- [ ] Performance metrics integration
## π License
MIT Β© [imankii01](https://github.com/imankii01)
## π Acknowledgments
- Inspired by the need for more personality in developer tools
- Built with love for the developer community
- Thanks to all contributors and users who make this project awesome
## π Connect with the Creator
- **GitHub**: [@imankii01](https://github.com/imankii01)
- **NPM**: [@imankii01](https://www.npmjs.com/~imankii01)
- **Issues**: [Report bugs or request features](https://github.com/imankii01/sassy-log/issues)
---
**Made with β€οΈ and a lot of sass by [imankii01](https://github.com/imankii01)**
*Because debugging should be fun, not frustrating!* π
## π Quick Reference
```javascript
// Basic usage
const log = require('sassy-log')();
// All methods
log('info message');
log.info('info message');
log.success('success message');
log.warn('warning message');
log.error('error message');
// Configuration
log.setMode('savage');
log.setColors(true);
log.setTimestamps(true);
log.setEmojis(false);
// Custom quotes
log.addCustomQuotes('savage', 'info', ['Your custom sass here']);
// Chaining
log.info('start').success('middle').error('end');
```
Now go forth and log with sass! π₯# sassy-log