{"id":47738018,"url":"https://github.com/nightdevilpt/footprint-logger","last_synced_at":"2026-04-02T23:04:06.118Z","repository":{"id":347056936,"uuid":"1192706420","full_name":"NightDevilPT/footprint-logger","owner":"NightDevilPT","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-26T13:39:43.000Z","size":158,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T05:31:17.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NightDevilPT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-26T13:36:48.000Z","updated_at":"2026-03-26T13:39:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/NightDevilPT/footprint-logger","commit_stats":null,"previous_names":["nightdevilpt/footprint-logger"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/NightDevilPT/footprint-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightDevilPT%2Ffootprint-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightDevilPT%2Ffootprint-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightDevilPT%2Ffootprint-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightDevilPT%2Ffootprint-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NightDevilPT","download_url":"https://codeload.github.com/NightDevilPT/footprint-logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightDevilPT%2Ffootprint-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31318157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T21:35:00.834Z","status":"ssl_error","status_checked_at":"2026-04-02T21:34:59.806Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-02T23:04:04.911Z","updated_at":"2026-04-02T23:04:06.107Z","avatar_url":"https://github.com/NightDevilPT.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Here's the updated documentation with the enhanced color customization and styling features:\n\n## 📋 Table of Contents\n\n- [Overview](#-overview)\n- [Key Features](#-key-features)\n- [Project Structure](#-project-structure)\n- [Installation](#-installation)\n- [Builder Pattern](#-builder-pattern)\n- [Custom Components](#-custom-components)\n- [Color \u0026 Styling](#-color--styling)\n- [Change Tracking](#-change-tracking)\n- [Framework Integrations](#-framework-integrations)\n- [Security Features](#-security-features)\n- [Performance](#-performance)\n- [API Reference](#-api-reference)\n\n---\n\n## 🚀 Overview\n\n**Universal Logger** is a comprehensive logging solution built with SOLID principles, featuring **Builder Pattern** for flexible configuration and **Factory Pattern** for dynamic component creation. It provides a unified logging experience across multiple frameworks with consistent APIs and production-ready features.\n\n### Core Philosophy\n\n- **Builder Pattern**: Fluent, intuitive, and type-safe configuration\n- **Factory Pattern**: Dynamic instantiation of formatters and transports\n- **Open/Closed Principle**: Easily extend with custom components\n- **Single Responsibility**: Each component has one clear purpose\n\n---\n\n## ✨ Key Features\n\n| Feature | Description |\n|---------|-------------|\n| 🏗️ **Builder Pattern** | Fluent configuration API for easy setup |\n| 🏭 **Factory Pattern** | Dynamic formatter \u0026 transport instantiation |\n| 🎨 **Custom Colors** | Define custom colors for each log level with cross-platform support |\n| 📝 **Custom Formatters** | Create your own log formatting logic with custom types |\n| 📁 **Custom Transports** | Send logs to any destination (API, DB, etc.) |\n| 🔧 **Type-Safe Context** | Define your own types for log context |\n| 📊 **Change Tracking** | Track before/after state changes with custom types |\n| 🎯 **Framework Agnostic** | Works with React, Next.js, Express, NestJS |\n| 🔒 **Security First** | Automatic PII/PCI-DSS compliant masking |\n| ⚡ **High Performance** | Async writes, intelligent buffering |\n| 🔄 **Log Rotation** | Automatic size/date-based rotation |\n| 🛡️ **Error Handling** | Comprehensive error capture |\n\n---\n\n## 🏗️ Project Structure\n\n```\nunilogger/\n│\n├── examples/\n│   ├── expressjs (ts)\n│   ├── reactjs (ts)\n│   ├── nextjs (ts)\n│   └── nestjs (ts)\n│\n├── src/\n│   ├── core/\n│   │   ├── Logger.ts              # Main logger class\n│   │   ├── LoggerBuilder.ts       # Builder pattern for config\n│   │   ├── LogEntry.ts            # Log entry structure with change tracking\n│   │   │\n│   │   ├── formatters/            # Formatter implementations\n│   │   │   ├── IFormatter.ts      # Formatter interface\n│   │   │   ├── PrettyFormatter.ts # Human-readable format\n│   │   │   ├── JsonFormatter.ts   # JSON format\n│   │   │   ├── LogfmtFormatter.ts # Logfmt format\n│   │   │   ├── StyledFormatter.ts # Styled terminal output with colors\n│   │   │   ├── FormatterFactory.ts # Factory for formatters\n│   │   │   └── index.ts\n│   │   │\n│   │   ├── transports/            # Transport implementations\n│   │   │   ├── ITransport.ts      # Transport interface\n│   │   │   ├── FileTransport.ts   # File output\n│   │   │   ├── TerminalTransport.ts # Console output with styling\n│   │   │   ├── JsonFileTransport.ts # JSON file output\n│   │   │   ├── TransportFactory.ts # Factory for transports\n│   │   │   └── index.ts\n│   │   │\n│   │   ├── styling/               # Styling utilities\n│   │   │   ├── IColorStrategy.ts  # Color strategy interface\n│   │   │   ├── ChalkStrategy.ts   # Backend/Node.js styling with chalk\n│   │   │   ├── CSSStrategy.ts     # Frontend styling with CSS\n│   │   │   ├── ColorManager.ts    # Color configuration manager\n│   │   │   └── index.ts\n│   │   │\n│   │   ├── security/              # Security features\n│   │   │   ├── IMasker.ts         # Masker interface\n│   │   │   ├── MaskingService.ts  # Sensitive data masking\n│   │   │   └── Patterns.ts        # Regex patterns\n│   │   │\n│   │   └── utils/                 # Shared utilities\n│   │       ├── fileUtils.ts       # File system utilities\n│   │       ├── environment.ts     # Environment detection\n│   │       └── validators.ts      # Validation functions\n│   │\n│   ├── react/                     # React integration\n│   │   ├── LoggerProvider.tsx     # React context provider\n│   │   ├── useLogger.ts           # React hook\n│   │   └── index.ts\n│   │\n│   ├── express/                   # Express.js integration\n│   │   ├── middleware.ts          # Express middleware\n│   │   └── index.ts\n│   │\n│   ├── nestjs/                    # NestJS integration\n│   │   ├── LoggerModule.ts        # NestJS module\n│   │   ├── LoggerService.ts       # NestJS service\n│   │   └── index.ts\n│   │\n│   └── index.ts                   # Main entry point\n│\n├── tests/                         # Test suite\n├── dist/                          # Built output\n└── package.json\n```\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install unilogger chalk\nyarn add unilogger chalk\npnpm add unilogger chalk\nbun add unilogger chalk\n```\n\n\u003e **Note**: `chalk` is optional for backend styling. The library will automatically detect the environment and use the appropriate styling strategy.\n\n---\n\n## 🏗️ Builder Pattern\n\n### Builder Methods\n\n| Method | Parameters | Description |\n|--------|------------|-------------|\n| `setAppName(name)` | `name: string` | Set application name |\n| `useTransport(type)` | `type: 'terminal' \\| 'file' \\| 'json-file'` | Select transport |\n| `setCustomTransport(transport)` | `transport: ITransport` | Use custom transport |\n| `useFormat(type)` | `type: 'pretty' \\| 'json' \\| 'logfmt' \\| 'styled'` | Select formatter |\n| `setCustomFormatter(formatter)` | `formatter: IFormatter` | Use custom formatter |\n| `setFilePath(path)` | `path: string` | File path for file transport |\n| `enableColors(enable)` | `enable: boolean` | Enable/disable colors |\n| `setColorConfig(config)` | `config: ColorConfig` | Set custom colors for log levels |\n| `enableMasking(enable)` | `enable: boolean` | Enable data masking |\n| `addMaskingPattern(pattern)` | `pattern: MaskingPattern` | Add custom masking pattern |\n| `setBufferSize(size)` | `size: number` | Set buffer size (entries) |\n| `setFlushInterval(ms)` | `ms: number` | Set flush interval (ms) |\n| `setMaxFileSize(bytes)` | `bytes: number` | Max file size before rotation |\n| `setMaxFiles(count)` | `count: number` | Max files to retain |\n| `setRetentionDays(days)` | `days: number` | Retention period in days |\n| `enableCompression(enable)` | `enable: boolean` | Enable gzip compression |\n| `enableChangeTracking(enable)` | `enable: boolean` | Enable change tracking |\n| `build()` | - | Build and return logger |\n\n---\n\n## 🎨 Color \u0026 Styling\n\nUniversal Logger provides intelligent, cross-platform color styling that automatically adapts to your environment.\n\n### Color Configuration Interface\n\n```typescript\ninterface ColorConfig {\n  info?: {\n    color?: string;      // Text color\n    bgColor?: string;    // Background color\n    bold?: boolean;      // Bold text\n    italic?: boolean;    // Italic text\n    underline?: boolean; // Underline text\n  };\n  debug?: {\n    color?: string;\n    bgColor?: string;\n    bold?: boolean;\n    italic?: boolean;\n    underline?: boolean;\n  };\n  warn?: {\n    color?: string;\n    bgColor?: string;\n    bold?: boolean;\n    italic?: boolean;\n    underline?: boolean;\n  };\n  error?: {\n    color?: string;\n    bgColor?: string;\n    bold?: boolean;\n    italic?: boolean;\n    underline?: boolean;\n  };\n  fatal?: {\n    color?: string;\n    bgColor?: string;\n    bold?: boolean;\n    italic?: boolean;\n    underline?: boolean;\n  };\n  timestamp?: {\n    color?: string;\n    bold?: boolean;\n  };\n  message?: {\n    color?: string;\n  };\n}\n```\n\n### Default Color Schemes\n\n| Level | Backend (Chalk) | Frontend (CSS) |\n|-------|-----------------|----------------|\n| **INFO** | `chalk.blue` | `color: #00aaff` |\n| **DEBUG** | `chalk.gray` | `color: #888888` |\n| **WARN** | `chalk.yellow.bold` | `color: #ffaa00; font-weight: bold` |\n| **ERROR** | `chalk.red.bold` | `color: #ff0000; font-weight: bold` |\n| **FATAL** | `chalk.red.bgWhite.bold` | `color: #ff0000; background: white; font-weight: bold` |\n\n### Custom Color Configuration\n\n#### Backend/Node.js Example (using Chalk)\n\n```typescript\nconst logger = new LoggerBuilder()\n  .setAppName('my-api')\n  .useFormat('styled')\n  .enableColors(true)\n  .setColorConfig({\n    info: {\n      color: 'cyan',        // Chalk color name\n      bold: true\n    },\n    warn: {\n      color: 'yellow',\n      bgColor: 'black',\n      bold: true,\n      underline: true\n    },\n    error: {\n      color: 'red',\n      bgColor: 'white',\n      bold: true,\n      italic: true\n    },\n    timestamp: {\n      color: 'gray',\n      bold: false\n    }\n  })\n  .build();\n```\n\n#### Frontend/Browser Example (using CSS)\n\n```typescript\nconst logger = new LoggerBuilder()\n  .setAppName('my-app')\n  .useFormat('styled')\n  .enableColors(true)\n  .setColorConfig({\n    info: {\n      color: '#00aaff',\n      bold: true\n    },\n    warn: {\n      color: '#ffaa00',\n      bgColor: '#332200',\n      bold: true,\n      underline: true\n    },\n    error: {\n      color: '#ff0000',\n      bgColor: '#ffcccc',\n      bold: true,\n      italic: true\n    },\n    debug: {\n      color: '#888888'\n    }\n  })\n  .build();\n```\n\n### Advanced Console Methods\n\nThe styled formatter supports advanced console methods for better debugging:\n\n```typescript\n// Console.table - Display data in tabular format\nlogger.table('User Data', usersArray);\n\n// Console.group - Group related logs\nlogger.group('API Request');\nlogger.info('Endpoint: /api/users');\nlogger.info('Method: POST');\nlogger.info('Status: 200');\nlogger.groupEnd();\n\n// Console.groupCollapsed - Collapsible groups\nlogger.groupCollapsed('Performance Metrics');\nlogger.info('Request duration: 245ms');\nlogger.info('Memory usage: 45MB');\nlogger.groupEnd();\n\n// Console.time - Time operations\nlogger.time('Database Query');\n// ... database operation\nlogger.timeEnd('Database Query');\n\n// Console.count - Count occurrences\nlogger.count('User Login');\nlogger.count('User Login');\nlogger.countReset('User Login');\n\n// Console.trace - Stack trace\nlogger.trace('Function called from');\n\n// Console.dir - Object inspection\nlogger.dir(complexObject, { depth: 2, colors: true });\n```\n\n### Environment Detection\n\nThe library automatically detects the runtime environment and applies the appropriate styling strategy:\n\n| Environment | Strategy | Styling Method |\n|-------------|----------|----------------|\n| **Node.js/Backend** | Chalk Strategy | `chalk.red.bold('message')` |\n| **Browser/Client** | CSS Strategy | `console.log('%c message', 'color: red')` |\n| **Server Components (Next.js)** | Auto-detection | Switches between strategies |\n| **React Native** | CSS-like Strategy | Uses style objects |\n\n### Manual Strategy Selection\n\nYou can manually specify the styling strategy:\n\n```typescript\n// Force backend styling\nconst backendLogger = new LoggerBuilder()\n  .setEnvironment('node')\n  .setColorConfig({ info: { color: 'cyan' } })\n  .build();\n\n// Force frontend styling\nconst frontendLogger = new LoggerBuilder()\n  .setEnvironment('browser')\n  .setColorConfig({ info: { color: '#00aaff' } })\n  .build();\n```\n\n### Styled Output Examples\n\n#### Backend Output (using Chalk)\n```bash\n[2024-01-15 10:30:45] ℹ INFO  → User logged in successfully\n[2024-01-15 10:30:46] ⚠ WARN  → Rate limit approaching (85%)\n[2024-01-15 10:30:47] ✖ ERROR → Database connection failed\n```\n\n#### Frontend Output (using CSS)\n![Styled Console Output](https://via.placeholder.com/600x200?text=Styled+Console+Output)\n\n### Creating Custom Color Strategies\n\n```typescript\n// Implement your own color strategy\nclass CustomColorStrategy implements IColorStrategy {\n  applyStyle(level: LogLevel, text: string, config?: LevelColorConfig): string {\n    // Custom implementation for your framework\n    // e.g., using chalk, CSS, or any other styling system\n    return styledText;\n  }\n  \n  getEnvironment(): 'node' | 'browser' | 'unknown' {\n    return 'node';\n  }\n}\n\n// Use custom strategy\nconst logger = new LoggerBuilder()\n  .setColorStrategy(new CustomColorStrategy())\n  .setColorConfig({ info: { color: 'magenta', bold: true } })\n  .build();\n```\n\n---\n\n## 🎨 Custom Components\n\n### Custom Formatter with Type-Safe Context\n\nCreate custom formatters with your own types for structured logging:\n\n```typescript\n// Define your custom context type\ninterface UserActionContext {\n  userId: string;\n  action: 'create' | 'update' | 'delete';\n  timestamp: Date;\n  metadata?: Record\u003cstring, any\u003e;\n}\n\n// Implement custom formatter\nclass UserActionFormatter implements IFormatter\u003cUserActionContext\u003e {\n  format(entry: ILogEntry\u003cUserActionContext\u003e): string {\n    // Your custom formatting logic here\n    return `${entry.timestamp} - ${entry.context?.userId} performed ${entry.context?.action}`;\n  }\n  \n  getType(): string {\n    return 'user-action';\n  }\n}\n\n// Use with custom types\nconst logger = new LoggerBuilder\u003cUserActionContext\u003e()\n  .setAppName('user-service')\n  .setCustomFormatter(new UserActionFormatter())\n  .build();\n\n// Type-safe logging with your context\nawait logger.info('User action performed', {\n  userId: '123',\n  action: 'update',\n  timestamp: new Date(),\n  metadata: { ip: '127.0.0.1' }\n});\n```\n\n### Custom Transport with Type-Safe Data\n\nCreate custom transports that handle your specific data structures:\n\n```typescript\n// Define your log data structure\ninterface APILogData {\n  endpoint: string;\n  method: string;\n  statusCode: number;\n  duration: number;\n  requestId: string;\n}\n\n// Implement custom transport\nclass APITransport implements ITransport\u003cAPILogData\u003e {\n  async write(data: APILogData): Promise\u003cvoid\u003e {\n    // Send to your API monitoring service\n    await fetch('https://api.monitoring.com/logs', {\n      method: 'POST',\n      body: JSON.stringify(data)\n    });\n  }\n  \n  async close(): Promise\u003cvoid\u003e {\n    // Cleanup\n  }\n  \n  getType(): string {\n    return 'api';\n  }\n}\n\n// Use with custom transport\nconst logger = new LoggerBuilder\u003cAPILogData\u003e()\n  .setAppName('api-gateway')\n  .setCustomTransport(new APITransport())\n  .useFormat('json')\n  .build();\n```\n\n### Generic Custom Formatter\n\nCreate reusable formatters that work with any type:\n\n```typescript\n// Generic formatter for any context type\nclass PrettyFormatter\u003cT\u003e implements IFormatter\u003cT\u003e {\n  format(entry: ILogEntry\u003cT\u003e): string {\n    return `[${entry.timestamp}] ${entry.message} ${JSON.stringify(entry.context)}`;\n  }\n  \n  getType(): string {\n    return 'pretty-generic';\n  }\n}\n\n// Use with different types\ninterface OrderContext {\n  orderId: string;\n  amount: number;\n  currency: string;\n}\n\ninterface PaymentContext {\n  transactionId: string;\n  paymentMethod: string;\n  status: 'success' | 'failed';\n}\n\nconst orderLogger = new LoggerBuilder\u003cOrderContext\u003e()\n  .setAppName('order-service')\n  .setCustomFormatter(new PrettyFormatter\u003cOrderContext\u003e())\n  .build();\n\nconst paymentLogger = new LoggerBuilder\u003cPaymentContext\u003e()\n  .setAppName('payment-service')\n  .setCustomFormatter(new PrettyFormatter\u003cPaymentContext\u003e())\n  .build();\n```\n\n---\n\n## 📊 Change Tracking with Custom Types\n\nTrack state changes with your own types:\n\n```typescript\n// Define your entity types\ninterface UserEntity {\n  id: string;\n  name: string;\n  email: string;\n  role: 'admin' | 'user';\n}\n\n// Track changes with type safety\nconst before: UserEntity = {\n  id: '123',\n  name: 'John Doe',\n  email: 'john@old.com',\n  role: 'user'\n};\n\nconst after: UserEntity = {\n  id: '123',\n  name: 'John Doe',\n  email: 'john@new.com',\n  role: 'admin'\n};\n\nconst change = await logger.logChange\u003cUserEntity\u003e(\n  'User updated',\n  before,\n  after,\n  { updatedBy: 'system' }\n);\n```\n\n---\n\n## ⚛️ Framework Integrations with Custom Types\n\n### React with Custom Types and Styling\n\n```typescript\n// Define your app-specific log context\ninterface AppLogContext {\n  component: string;\n  userId?: string;\n  action?: string;\n}\n\n// Create typed hook\nconst { logger } = useLogger\u003cAppLogContext\u003e();\n\n// Type-safe logging with automatic client-side styling\nlogger.info('Component mounted', {\n  component: 'UserProfile',\n  userId: '123'\n});\n\n// Advanced console methods in browser\nlogger.table('User Data', users);\nlogger.group('API Call');\nlogger.time('Request');\n```\n\n### Express with Custom Types and Terminal Styling\n\n```typescript\n// Define request log context\ninterface RequestContext {\n  method: string;\n  path: string;\n  userId?: string;\n  correlationId: string;\n}\n\nconst logger = new LoggerBuilder\u003cRequestContext\u003e()\n  .setAppName('api')\n  .useFormat('styled')\n  .setColorConfig({\n    info: { color: 'green', bold: true },\n    warn: { color: 'yellow', bold: true },\n    error: { color: 'red', bold: true }\n  })\n  .build();\n\napp.use((req, res, next) =\u003e {\n  logger.info('Request received', {\n    method: req.method,\n    path: req.path,\n    correlationId: req.headers['x-correlation-id'] as string\n  });\n  next();\n});\n```\n\n### Next.js with Mixed Environment Support\n\n```typescript\n// This works in both server and client components\nconst logger = new LoggerBuilder()\n  .setAppName('next-app')\n  .useFormat('styled')\n  .enableColors(true)\n  .setColorConfig({\n    info: { color: 'blue' },\n    warn: { color: 'orange', bold: true },\n    error: { color: 'red', bold: true }\n  })\n  .build();\n\n// Server Component (uses chalk)\nexport default async function ServerComponent() {\n  logger.info('Rendering on server');\n  return \u003cdiv\u003eContent\u003c/div\u003e;\n}\n\n// Client Component (uses CSS styling)\n'use client';\nexport function ClientComponent() {\n  const { logger } = useLogger();\n  \n  useEffect(() =\u003e {\n    logger.info('Mounted on client');\n    logger.table('Props', { name: 'value' });\n  }, []);\n  \n  return \u003cdiv\u003eContent\u003c/div\u003e;\n}\n```\n\n### NestJS with Custom Types\n\n```typescript\n// Define module-specific context\ninterface UserModuleContext {\n  module: 'users';\n  operation: 'create' | 'find' | 'update';\n  userId?: string;\n}\n\n@Injectable()\nclass UsersService {\n  constructor(private logger: Logger\u003cUserModuleContext\u003e) {}\n  \n  async createUser(data: any) {\n    this.logger.info('Creating user', {\n      module: 'users',\n      operation: 'create'\n    });\n  }\n}\n```\n\n---\n\n## 🔒 Security Features\n\n### Automatic Masking\n\nBuilt-in patterns for sensitive data:\n- Passwords, tokens, API keys\n- Credit card numbers\n- Social security numbers\n- Email addresses (partial masking)\n- Authorization headers\n\n### Custom Masking with Types\n\n```typescript\n// Define sensitive data types\ninterface SensitiveData {\n  password: string;\n  ssn: string;\n  creditCard: string;\n}\n\nconst logger = new LoggerBuilder\u003cSensitiveData\u003e()\n  .enableMasking(true)\n  .addMaskingPattern({\n    pattern: /password=\\w+/gi,\n    replacement: 'password=***'\n  })\n  .addMaskingPattern({\n    pattern: /ssn=\\d{3}-\\d{2}-\\d{4}/gi,\n    replacement: 'ssn=***-**-****'\n  })\n  .build();\n```\n\n---\n\n## ⚡ Performance Optimizations\n\n| Feature | Description |\n|---------|-------------|\n| **Async Writes** | Non-blocking I/O operations |\n| **Buffering** | In-memory buffer before flush |\n| **Configurable Queue** | Block, drop, or flush on overflow |\n| **Log Rotation** | Automatic size/date-based rotation |\n| **Compression** | Optional gzip compression for rotated logs |\n| **Retention** | Automatic cleanup of old log files |\n\n---\n\n## 📚 API Reference\n\n### Logger Class with Generics\n\n| Method | Parameters | Returns | Description |\n|--------|------------|---------|-------------|\n| `info\u003cT\u003e(message, context?)` | `message: string, context?: T` | `Promise\u003cILogChange\u003cT\u003e \\| void\u003e` | Log info level |\n| `debug\u003cT\u003e(message, context?)` | `message: string, context?: T` | `Promise\u003cILogChange\u003cT\u003e \\| void\u003e` | Log debug level |\n| `warn\u003cT\u003e(message, context?)` | `message: string, context?: T` | `Promise\u003cILogChange\u003cT\u003e \\| void\u003e` | Log warning level |\n| `error\u003cT\u003e(message, error?, context?)` | `message: string, error?: Error, context?: T` | `Promise\u003cILogChange\u003cT\u003e \\| void\u003e` | Log error level |\n| `fatal\u003cT\u003e(message, error?, context?)` | `message: string, error?: Error, context?: T` | `Promise\u003cILogChange\u003cT\u003e \\| void\u003e` | Log fatal level |\n| `table\u003cT\u003e(title, data)` | `title: string, data: T[] \\| object` | `void` | Display data in table format |\n| `group(title, fn?)` | `title: string, fn?: () =\u003e void` | `void` | Group related logs |\n| `groupCollapsed(title, fn?)` | `title: string, fn?: () =\u003e void` | `void` | Create collapsible group |\n| `groupEnd()` | - | `void` | End current group |\n| `time(label)` | `label: string` | `void` | Start timer |\n| `timeEnd(label)` | `label: string` | `void` | End timer and log duration |\n| `count(label)` | `label: string` | `void` | Increment and log counter |\n| `countReset(label)` | `label: string` | `void` | Reset counter |\n| `trace(message, ...args)` | `message: string, ...args: any[]` | `void` | Log with stack trace |\n| `dir(obj, options?)` | `obj: any, options?: any` | `void` | Inspect object |\n| `logChange\u003cT\u003e(message, before, after, context?)` | `message: string, before: T, after: T, context?: object` | `Promise\u003cILogChange\u003cT\u003e\u003e` | Log state change |\n| `batch\u003cT\u003e(entries)` | `entries: BatchEntry\u003cT\u003e[]` | `Promise\u003cvoid\u003e` | Log multiple entries |\n| `flush()` | - | `Promise\u003cvoid\u003e` | Flush buffered logs |\n| `shutdown()` | - | `Promise\u003cvoid\u003e` | Graceful shutdown |\n\n### IFormatter Interface with Generics\n\n| Method | Returns | Description |\n|--------|---------|-------------|\n| `format\u003cT\u003e(entry: ILogEntry\u003cT\u003e)` | `string` | Format log entry with generic context |\n| `getType()` | `string` | Get formatter type |\n\n### ITransport Interface with Generics\n\n| Method | Returns | Description |\n|--------|---------|-------------|\n| `write\u003cT\u003e(data: T)` | `Promise\u003cvoid\u003e` | Write typed log data |\n| `close()` | `Promise\u003cvoid\u003e` | Close transport |\n| `getType()` | `string` | Get transport type |\n\n### ILogEntry Interface with Generics\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `timestamp` | `Date` | Log timestamp |\n| `level` | `LogLevel` | Log level |\n| `message` | `string` | Log message |\n| `context` | `T` | Type-safe context data |\n| `error` | `Error?` | Error object |\n| `pid` | `number` | Process ID |\n| `hostname` | `string` | Hostname |\n| `appName` | `string?` | Application name |\n| `correlationId` | `string?` | Correlation ID |\n\n### Log Levels\n\n| Level | Priority | Description |\n|-------|----------|-------------|\n| `DEBUG` | 10 | Detailed debugging information |\n| `INFO` | 20 | General application events |\n| `WARN` | 30 | Warning conditions |\n| `ERROR` | 40 | Error conditions requiring attention |\n| `FATAL` | 50 | Critical errors causing termination |\n\n### Output Formats\n\n| Format | Description | Best For |\n|--------|-------------|---------|\n| **Pretty** | Human-readable with colors | Development |\n| **Styled** | Enhanced terminal/browser styling with custom colors | Production \u0026 Development |\n| **JSON** | Structured format | Production log aggregators |\n| **Logfmt** | Key-value format | Grep-friendly operations |\n\n### Transports\n\n| Transport | Description |\n|-----------|-------------|\n| **Terminal** | Console output with intelligent styling (chalk/CSS) |\n| **File** | Plain text file output |\n| **JSON File** | Structured JSON file output |\n\n---\n\n## 📄 License\n\nMIT © NightDevilPT\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eBuilt with ❤️ using Builder \u0026 Factory Patterns with full TypeScript generic support and intelligent cross-platform styling\u003c/sub\u003e\n\u003c/div\u003e\n```\n\n### Key Additions \u0026 Changes:\n\n1. **New Styling Section** - Complete documentation for color customization\n2. **ColorConfig Interface** - Type-safe color configuration structure\n3. **Cross-Platform Support** - Automatic detection and switching between Chalk (backend) and CSS (frontend)\n4. **Advanced Console Methods** - Support for `table()`, `group()`, `time()`, `count()`, `trace()`, `dir()`\n5. **Styled Formatter** - New formatter type that supports custom colors and styles\n6. **Environment Detection** - Automatic detection of Node.js vs browser environment\n7. **Custom Color Strategies** - Ability to implement custom styling strategies\n8. **Next.js Server/Client Support** - Automatic handling of mixed environments\n9. **Color Strategy Architecture** - New styling directory with strategy pattern implementation\n10. **Updated Examples** - Real-world examples for both backend and frontend styling","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightdevilpt%2Ffootprint-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnightdevilpt%2Ffootprint-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightdevilpt%2Ffootprint-logger/lists"}