{"_id":"leaf-logger","_rev":"33-7e7c0253f9545c065d59944668e3141c","name":"leaf-logger","dist-tags":{"latest":"1.3.0"},"versions":{"1.2.0":{"name":"leaf-logger","version":"1.2.0","keywords":["logger","logging","leaf"],"author":{"name":"Jakub Urbański"},"license":"MIT","_id":"leaf-logger@1.2.0","maintainers":[{"name":"kubaivo","email":"ivo.urbanski@gmail.com"}],"dist":{"shasum":"5eba28ce6f1374aac3bf8c5b9476e91587b5b3d4","tarball":"https://registry.npmjs.org/leaf-logger/-/leaf-logger-1.2.0.tgz","fileCount":4,"integrity":"sha512-VdtCX8GmcRGY/eum+oOhfrimhBXgF3Sj7AT7MmP37298vpnJmeEAJ7YNhkogM5qvj4w7bNHykwpNquXfBGoPwA==","signatures":[{"sig":"MEUCIFiyP2oAGC4AvfTXiO/idYrb94NFkdCx5sui2AAaOteJAiEAqqR3feluBeg3Ig2DuaFX7jEDuAw12CvLG5cWDyG549k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9116},"main":"index.js","gitHead":"3be5566e1c233d328445bda686b99ccd1d34c474","scripts":{"test":"node test.js"},"_npmUser":{"name":"kubaivo","email":"ivo.urbanski@gmail.com"},"_npmVersion":"11.4.2","description":"A minimal logging package with icons","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaf-logger_1.2.0_1756454546271_0.07665433551129253","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"leaf-logger","version":"1.2.1","keywords":["logger","logging","leaf"],"author":{"name":"Jakub Urbański"},"license":"MIT","_id":"leaf-logger@1.2.1","maintainers":[{"name":"kubaivo","email":"ivo.urbanski@gmail.com"}],"dist":{"shasum":"be7cee14ca773c5673fc72439e01c7e3dbbb7a20","tarball":"https://registry.npmjs.org/leaf-logger/-/leaf-logger-1.2.1.tgz","fileCount":4,"integrity":"sha512-EXSES/tcbuYXvds2whbmow3/mQxVZzEAk4KN1pCQGU0VAOodoLxz6VtXnnk9OXrDwLIMdMgOIZkj6hBmmSJ2xA==","signatures":[{"sig":"MEYCIQCtRAvsWmoD3KWwZwKTFZVWHAGacmoywNFI/EZEmH0KawIhALHn6W9nJwgzrBVTasj2sEehxAJiBUpw/ucV2St3XwDn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9241},"main":"index.js","gitHead":"01c5601c8ff55066225249b84bfa62180e65bdcb","scripts":{"test":"node test.js"},"_npmUser":{"name":"kubaivo","email":"ivo.urbanski@gmail.com"},"_npmVersion":"11.4.2","description":"A minimal logging package with icons","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaf-logger_1.2.1_1756455785165_0.5877227242104657","host":"s3://npm-registry-packages-npm-production"}},"1.2.2":{"name":"leaf-logger","version":"1.2.2","keywords":["logger","logging","leaf"],"author":{"name":"Jakub Urbański"},"license":"MIT","_id":"leaf-logger@1.2.2","maintainers":[{"name":"kubaivo","email":"ivo.urbanski@gmail.com"}],"dist":{"shasum":"8a4c9169fe9d11ff7b9ea512c29d0eb72ecc6a15","tarball":"https://registry.npmjs.org/leaf-logger/-/leaf-logger-1.2.2.tgz","fileCount":4,"integrity":"sha512-gaU+EojO7L2QMIkUyIS3nLkbqWRBsiJZCc2n9tWA4E3avSFucQwcBDlvorndTbgzLtoZ4IzrXwiUzW9mfydYXQ==","signatures":[{"sig":"MEQCICFWTEwjj++F6trbCj0mDgoE8LiELFX5gvaFlSXllbgDAiBJnCTBjnW8S5VK75yS1AZQgJ6eXBnJXjBgUZ+3WtIT8g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10799},"main":"index.js","gitHead":"baf626e6a2ed426c07f6248e22423796e8a42e0d","scripts":{"test":"node test.js"},"_npmUser":{"name":"kubaivo","email":"ivo.urbanski@gmail.com"},"_npmVersion":"11.4.2","description":"A minimal logging package with icons","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaf-logger_1.2.2_1756456188972_0.6342287412476857","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"leaf-logger","version":"1.3.0","description":"A minimal logging package with icons","main":"index.js","scripts":{"test":"node test.js"},"keywords":["logger","logging","leaf"],"author":{"name":"Jakub Urbański"},"license":"MIT","_id":"leaf-logger@1.3.0","gitHead":"f19c13a9055ad74a69bd76e16c651141757883ac","_nodeVersion":"22.17.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-Sy+SguXRnOr7ckjvqUyAjuG6fh5OkEU/YUUKA9F24uVxbELecyRfBN9icnqyVooCjjCRn11XlV9ffX/z1jhjUw==","shasum":"7acbd27ecb8f153c61b82f1524dfc44747f68d96","tarball":"https://registry.npmjs.org/leaf-logger/-/leaf-logger-1.3.0.tgz","fileCount":6,"unpackedSize":15676,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE0+aQhALzQnjGH5AkS2FnrO32+j4KQsrJWK5QkSF+1AAiAdWDQRSP20Bu+J94ZOIm7YVRShJRnQAM4qENp1KOVsEg=="}]},"_npmUser":{"name":"kubaivo","email":"ivo.urbanski@gmail.com"},"directories":{},"maintainers":[{"name":"kubaivo","email":"ivo.urbanski@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/leaf-logger_1.3.0_1756458739409_0.2971680073993501"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-29T08:02:26.172Z","modified":"2025-08-29T09:12:19.780Z","1.0.0":"2017-07-16T10:58:21.172Z","1.0.1":"2017-07-16T12:00:54.963Z","1.0.2":"2017-07-16T12:02:04.097Z","1.0.3":"2017-07-16T12:14:36.184Z","1.0.4":"2017-07-16T12:26:34.182Z","1.0.5":"2017-07-16T18:58:54.857Z","2.0.0":"2017-10-03T18:55:36.427Z","2.0.2":"2017-10-03T19:06:34.250Z","2.0.3":"2017-10-03T19:07:33.070Z","2.0.4":"2017-10-03T19:10:28.025Z","2.0.5":"2017-10-03T19:12:52.618Z","2.0.6":"2017-10-03T19:14:17.741Z","2.0.7":"2017-10-05T07:22:12.123Z","2.0.8":"2017-12-06T12:49:29.026Z","2.0.9":"2017-12-06T12:53:24.384Z","3.0.0":"2018-03-23T21:44:45.186Z","3.1.0":"2018-03-26T16:08:59.028Z","3.2.0":"2018-03-27T19:06:21.930Z","3.2.1":"2018-03-27T19:08:23.240Z","4.0.0":"2019-08-28T16:37:10.961Z","4.0.1":"2019-10-30T18:12:45.985Z","4.1.0":"2020-06-19T14:56:16.214Z","4.1.1":"2020-06-19T14:59:45.853Z","1.2.0":"2025-08-29T08:02:26.462Z","1.2.1":"2025-08-29T08:23:05.312Z","1.2.2":"2025-08-29T08:29:49.146Z","1.3.0":"2025-08-29T09:12:19.594Z"},"author":{"name":"Jakub Urbański"},"license":"MIT","keywords":["logger","logging","leaf"],"description":"A minimal logging package with icons","maintainers":[{"name":"kubaivo","email":"ivo.urbanski@gmail.com"}],"readme":"# LeafLogger\r\n\r\nA lightweight, customizable logger with colorful output and emoji icons for Node.js applications.\r\n\r\n![LeafLogger Preview](https://raw.githubusercontent.com/frogalo/leaf-log/refs/heads/main/preview.png)\r\n\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n  - [Basic Usage](#basic-usage)\r\n  - [Object Logging](#object-logging)\r\n  - [Configuration](#configuration)\r\n  - [Runtime Configuration Updates](#runtime-configuration-updates)\r\n  - [Log Levels](#log-levels)\r\n  - [Debug Configuration](#debug-configuration)\r\n  - [Promise Handling](#promise-handling)\r\n- [Configuration Options](#configuration-options)\r\n- [Examples](#examples)\r\n- [Log Levels Reference](#log-levels-reference)\r\n- [License](#license)\r\n\r\n## Features\r\n\r\n-   Colorful log messages with RGB precision\r\n-   Emoji icons for visual distinction\r\n-   Timestamp support with date and time\r\n-   Multiple log levels (error, warn, info, success, debug)\r\n-   Configurable debug mode\r\n-   Object logging support with clear borders\r\n-   Automatic Promise resolution in logged data\r\n-   Runtime configuration updates\r\n-   Zero dependencies\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install leaf-logger\r\n```\r\n\r\n## Usage\r\n\r\n### Basic Usage\r\n\r\n```javascript\r\nconst LeafLogger = require('leaf-logger');\r\n\r\nconst logger = LeafLogger();\r\n\r\nlogger.info('This is an info message');\r\nlogger.warn('This is a warning');\r\nlogger.error('This is an error');\r\nlogger.success('This is a success message');\r\nlogger.debug('This is a debug message'); // Only visible if `debug` option is true\r\n```\r\n\r\n### Object Logging\r\n\r\nLeafLogger supports logging objects as additional data. It will automatically format and border the JSON output.\r\n\r\n```javascript\r\nconst logger = LeafLogger({ level: 'debug' });\r\n\r\n// Log an object with your message\r\nlogger.info('User login', {\r\n    userId: 12345,\r\n    username: 'john_doe',\r\n    timestamp: new Date().toISOString()\r\n});\r\n// Output will include:\r\n// [YYYY-MM-DD, HH:MM:SS] 🍃 User login\r\n// │ {\r\n// │   \"userId\": 12345,\r\n// │   \"username\": \"john_doe\",\r\n// │   \"timestamp\": \"YYYY-MM-DDTHH:MM:SS.sssZ\"\r\n// │ }\r\n\r\nlogger.error('Database connection failed', {\r\n    host: 'localhost',\r\n    port: 5432,\r\n    error: 'Connection timeout'\r\n});\r\n```\r\n\r\n### Configuration\r\n\r\nYou can customize the logger behavior by passing a configuration object during initialization:\r\n\r\n```javascript\r\nconst logger = LeafLogger({\r\n    level: 'debug',     // Minimum log level to display\r\n    timestamp: true,    // Show timestamps\r\n    colors: true,       // Enable colored output\r\n    icons: true,        // Show emoji icons\r\n    debug: false        // Enable/disable debug messages independently\r\n});\r\n```\r\n\r\n### Runtime Configuration Updates\r\n\r\nThe logger's configuration can be updated after it has been initialized using the `updateConfig` method.\r\n\r\n```javascript\r\nconst logger = LeafLogger({ level: 'info', colors: true });\r\n\r\nlogger.info('This message is colorful.'); // Output with colors\r\n\r\nlogger.updateConfig({ colors: false, timestamp: false }); // Update configuration\r\n\r\nlogger.warn('This message is not colorful and has no timestamp.'); // Output without colors or timestamp\r\n```\r\n\r\n### Log Levels\r\n\r\nAvailable log levels (in order of priority, from lowest to highest numerical value):\r\n0. `error` - Critical issues\r\n1. `warn` - Warning messages\r\n2. `info` / `success` - Informational messages\r\n3. `debug` - Debugging information\r\n\r\nWhen you set a `level` in the configuration, all messages at that level and higher priority will be displayed:\r\n\r\n```javascript\r\nconst infoLogger = LeafLogger({ level: 'info' }); // Shows info, success, warn, error\r\ninfoLogger.info('Visible info');\r\ninfoLogger.warn('Visible warning');\r\ninfoLogger.debug('Hidden debug'); // level: info (2), debug: 3. debug will not be shown\r\n                                // unless `debug: true` in config.\r\n\r\nconst debugLogger = LeafLogger({ level: 'debug', debug: true }); // Shows all messages\r\ndebugLogger.debug('Visible debug');\r\n```\r\n\r\n### Debug Configuration\r\n\r\nThe `debug` option allows you to control debug messages independently of the main `level` setting.\r\n\r\n-   If `debug: true`, debug messages will always be shown.\r\n-   If `debug: false`, debug messages will never be shown, even if `level` is set to `'debug'`.\r\n\r\n```javascript\r\n// Enable debug messages even if the general level is higher\r\nconst debugOnLogger = LeafLogger({\r\n    level: 'info', // Info and above are visible\r\n    debug: true    // Debug messages will *also* show\r\n});\r\ndebugOnLogger.info('Info message (visible)');\r\ndebugOnLogger.debug('Debug message (visible due to debug: true)', { var: 1 });\r\n\r\n// Disable debug messages completely, even if log level is debug\r\nconst debugOffLogger = LeafLogger({\r\n    level: 'debug', // Debug level is set\r\n    debug: false    // But debug messages are explicitly disabled\r\n});\r\ndebugOffLogger.info('Info message (visible)');\r\ndebugOffLogger.debug('Debug message (hidden due to debug: false)');\r\n```\r\n\r\n### Promise Handling\r\n\r\nLeafLogger automatically detects if your logged data contains `Promise` values (either directly, in an array, or nested within an object). It will then asynchronously resolve these promises before serializing and logging the data, ensuring your logs always show the final resolved state.\r\n\r\n```javascript\r\nconst logger = LeafLogger({ level: 'debug' });\r\n\r\n// Logging a Promise directly\r\nconst userDataPromise = Promise.resolve({ id: 123, name: 'John Doe' });\r\nlogger.info('User data fetched', userDataPromise);\r\n// Output will show the resolved user data\r\n\r\n// Logging an object containing Promises\r\nconst apiResponsePromise = Promise.resolve({\r\n    status: 'success',\r\n    detail: 'Operation completed'\r\n});\r\nlogger.info('API response received', {\r\n    statusCode: 200,\r\n    timestamp: new Date().toISOString(),\r\n    result: apiResponsePromise,\r\n    nested: {\r\n        info: 'some more data',\r\n        anotherPromise: Promise.resolve('resolved nested promise')\r\n    }\r\n});\r\n// Output will show the resolved status and data after promises are settled.\r\n```\r\n\r\n## Configuration Options\r\n\r\n| Option      | Type      | Default   | Description                                                                  |\r\n|-------------|-----------|-----------|------------------------------------------------------------------------------|\r\n| `level`     | `string`  | `'info'`  | Minimum log level to display (`error`, `warn`, `info`, `success`, `debug`)   |\r\n| `timestamp` | `boolean` | `true`    | Show/hide timestamps with date and time                                      |\r\n| `colors`    | `boolean` | `true`    | Enable/disable colored output                                                |\r\n| `icons`     | `boolean` | `true`    | Show/hide emoji icons                                                        |\r\n| `debug`     | `boolean` | `false`   | Enable/disable debug messages. If `true`, debug messages are always shown. If `false`, they are never shown, overriding `level`. |\r\n\r\n## Examples\r\n\r\n#### Minimal Output\r\n```javascript\r\nconst minimalLogger = LeafLogger({\r\n    timestamp: false,\r\n    colors: false,\r\n    icons: false\r\n});\r\n\r\nminimalLogger.info('Simple message');\r\n// Output: Simple message\r\n```\r\n\r\n#### Timestamp Only\r\n```javascript\r\nconst timeLogger = LeafLogger({\r\n    colors: false,\r\n    icons: false\r\n});\r\n\r\ntimeLogger.info('Timestamped message');\r\n// Output: [YYYY-MM-DD, HH:MM:SS] Timestamped message\r\n```\r\n\r\n#### Colorful with Icons\r\n```javascript\r\nconst visualLogger = LeafLogger();\r\n\r\nvisualLogger.error('Critical error!');\r\n// Example Output: [2025-08-28, 16:30:25] 🍁 Critical error!\r\n```\r\n\r\n#### Object Logging\r\n```javascript\r\nconst logger = LeafLogger({ level: 'debug' });\r\n\r\nlogger.info('User action', {\r\n    userId: 12345,\r\n    action: 'file_upload',\r\n    fileName: 'document.pdf',\r\n    fileSize: '2.3MB'\r\n});\r\n// Example Output:\r\n// [2025-08-28, 16:30:25] 🍃 User action\r\n// │ {\r\n// │   \"userId\": 12345,\r\n// │   \"action\": \"file_upload\",\r\n// │   \"fileName\": \"document.pdf\",\r\n// │   \"fileSize\": \"2.3MB\"\r\n// │ }\r\n```\r\n\r\n#### Debug Control\r\n```javascript\r\nconst logger = LeafLogger({\r\n    level: 'info',\r\n    debug: true\r\n});\r\n\r\nlogger.info('Info message');\r\nlogger.debug('Debug message', { variable: 'value' });\r\n// Example Output:\r\n// [2025-08-28, 16:30:25] 🍃 Info message\r\n// [2025-08-28, 16:30:25] 🌱 Debug message\r\n// │ {\r\n// │   \"variable\": \"value\"\r\n// │ }\r\n```\r\n\r\n## Log Levels Reference\r\n\r\n| Level     | Color     | Icon | Use Case                     |\r\n|-----------|-----------|------|------------------------------|\r\n| `error`   | Red       | 🍁   | Critical errors and failures |\r\n| `warn`    | Amber     | 🍂   | Warnings and non-critical issues |\r\n| `info`    | Sky Blue  | 🍃   | General informational messages |\r\n| `success` | Mint Green| 🌿   | Successful operations and positive confirmations |\r\n| `debug`   | Lavender  | 🌱   | Detailed debugging information |\r\n\r\n## License\r\n\r\nMIT © 2025","readmeFilename":"README.md"}