{"_id":"@beherapratyush/logger","_rev":"2-31c643896960b81c2fe1736dcd0dbf21","name":"@beherapratyush/logger","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@beherapratyush/logger","version":"1.0.0","keywords":["logger","logging","node","browser","chalk","json","structured-logging"],"author":{"name":"Pratyush pratyushbehera@gmail.com"},"license":"MIT","_id":"@beherapratyush/logger@1.0.0","maintainers":[{"name":"beherapratyush","email":"pratyushbehera@icloud.com"}],"dist":{"shasum":"51f214e6705363c6c6936b723f55fa75dbec1b26","tarball":"https://registry.npmjs.org/@beherapratyush/logger/-/logger-1.0.0.tgz","fileCount":5,"integrity":"sha512-lF975Yy3XWdAevBObwFV477jlqweftBFI3DAoeUKFW5mHMTTFrlHrZrbSJAMPhCM9IzPVd0d2LhY/uo8sRO8GQ==","signatures":[{"sig":"MEQCIB/Zc+DIpIPDxo/0MPWaj/BGs7Zvb4c6K8CWshfXL4ItAiAc13ApJ5gsNbIJbnBRoMEOX94gApEkRCUynGDryj7zgQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15338},"main":"./dist/smart-logger.js","browser":"./dist/smart-logger.js","engines":{"node":">=12.0.0"},"gitHead":"af22f509f6bc93f502d262611ec3363ff9b4dbe8","scripts":{"test":"jest","build":"webpack","test:watch":"jest --watchAll","test:coverage":"jest --coverage"},"_npmUser":{"name":"beherapratyush","email":"pratyushbehera@icloud.com"},"_npmVersion":"11.1.0","description":"A customizable logging utility for Node.js and browser environments.","directories":{},"_nodeVersion":"20.18.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","webpack":"^5.98.0","babel-jest":"^27.0.6","@babel/core":"^7.26.9","webpack-cli":"^4.10.0","babel-loader":"^10.0.0","@babel/preset-env":"^7.26.9","terser-webpack-plugin":"^5.3.12"},"_npmOperationalInternal":{"tmp":"tmp/logger_1.0.0_1740762084076_0.6901664662039988","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@beherapratyush/logger","version":"1.0.1","keywords":["logger","logging","node","browser","chalk","json","structured-logging"],"author":{"name":"Pratyush pratyushbehera@gmail.com"},"license":"MIT","_id":"@beherapratyush/logger@1.0.1","maintainers":[{"name":"beherapratyush","email":"pratyushbehera@icloud.com"}],"dist":{"shasum":"8fd8cc2b0e78bdb81e407db89a5739f73a4c5094","tarball":"https://registry.npmjs.org/@beherapratyush/logger/-/logger-1.0.1.tgz","fileCount":5,"integrity":"sha512-3o0BgYs4pplUGpMwVsgMOidyCT0qNk5LNHFF2UGV4J1c3hSsdKIMIneRg0iurpVdrNSDeA4ZwU/JffE3ftHH/Q==","signatures":[{"sig":"MEUCIHhIpl0jUVu25CUCu61jYrlXWwkzHYU0QAyAf6Dzyh/aAiEAkr7Jc/J7xcZgU1lnWEyaAHStSmvYPqz/IgYD60zBxb0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15378},"main":"./dist/smart-logger.js","browser":"./dist/smart-logger.js","engines":{"node":">=12.0.0"},"gitHead":"f8a875ea6f99bd22bf86b9a4f22e6208541ca164","scripts":{"test":"jest","build":"webpack","test:watch":"jest --watchAll","test:coverage":"jest --coverage"},"_npmUser":{"name":"beherapratyush","email":"pratyushbehera@icloud.com"},"_npmVersion":"11.1.0","description":"A customizable logging utility for Node.js and browser environments.","directories":{},"_nodeVersion":"20.18.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","webpack":"^5.98.0","babel-jest":"^27.0.6","@babel/core":"^7.26.9","webpack-cli":"^4.10.0","babel-loader":"^10.0.0","@babel/preset-env":"^7.26.9","terser-webpack-plugin":"^5.3.12"},"_npmOperationalInternal":{"tmp":"tmp/logger_1.0.1_1740762801375_0.41360566493222284","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@beherapratyush/logger","version":"1.0.2","description":"A customizable logging utility for Node.js and browser environments.","main":"./dist/smart-logger.js","browser":"./dist/smart-logger.js","scripts":{"build":"webpack","test":"jest","test:watch":"jest --watchAll","test:coverage":"jest --coverage"},"keywords":["logger","logging","node","browser","chalk","json","structured-logging"],"author":{"name":"Pratyush pratyushbehera@gmail.com"},"license":"MIT","devDependencies":{"@babel/core":"^7.26.9","@babel/preset-env":"^7.26.9","babel-jest":"^27.0.6","babel-loader":"^10.0.0","jest":"^27.5.1","terser-webpack-plugin":"^5.3.12","webpack":"^5.98.0","webpack-cli":"^4.10.0"},"engines":{"node":">=12.0.0"},"_id":"@beherapratyush/logger@1.0.2","gitHead":"15cc5e487b2616e2f3bd6f9a72cd2e013542029f","_nodeVersion":"20.18.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-0CNF0fth5ApQbPjBEK0D6HGKf1YrM/0918h7lVVo36L8uzmQNaNe1jS9mnhr/tZIFrmYqPgo8UUczqV831TZVg==","shasum":"04863eff6224f26ced5ce717575408dd47598996","tarball":"https://registry.npmjs.org/@beherapratyush/logger/-/logger-1.0.2.tgz","fileCount":5,"unpackedSize":15408,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHmqIaL1Wm524nvL/xT8EGtmFQYJp1UeosmKo5szei+CAiEAyUTL+fyovJ3QpAmuxxbtagtnJDnQ2h396kTNQD+N4i0="}]},"_npmUser":{"name":"beherapratyush","email":"pratyushbehera@icloud.com"},"directories":{},"maintainers":[{"name":"beherapratyush","email":"pratyushbehera@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/logger_1.0.2_1740764074143_0.815191585944745"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-28T17:01:24.015Z","modified":"2025-02-28T17:34:34.454Z","1.0.0":"2025-02-28T17:01:24.302Z","1.0.1":"2025-02-28T17:13:21.599Z","1.0.2":"2025-02-28T17:34:34.294Z"},"author":{"name":"Pratyush pratyushbehera@gmail.com"},"license":"MIT","keywords":["logger","logging","node","browser","chalk","json","structured-logging"],"description":"A customizable logging utility for Node.js and browser environments.","maintainers":[{"name":"beherapratyush","email":"pratyushbehera@icloud.com"}],"readme":"# Smart Logger\n\n![License](https://img.shields.io/badge/license-MIT-blue)\n![Version](https://img.shields.io/npm/v/@beherapratyush/logger)\n![Downloads](https://img.shields.io/npm/dm/@beherapratyush/logger)\n\nA lightweight and customizable logger for both **browser** and **Node.js** environments. Supports log levels (`debug`, `info`, `warn`, `error`) and colored output.\n\n## Features\n\n- **Universal**: Works in both browser and Node.js environments.\n- **Custom Log Levels**: Set the minimum log level to control output.\n- **Colored Output**: Logs are color-coded for better readability.\n- **Lightweight**: No external dependencies.\n\n## Installation\n\nInstall the package via npm:\n\n```bash\nnpm install @beherapratyush/logger\n```\n\nOr via yarn:\n\n```bash\nyarn add @beherapratyush/logger\n```\n\n---\n\n## Usage\n\n### Basic Usage\n\n```javascript\nimport SmartLogger from \"@beherapratyush/logger\";\n\n// Create a logger instance\nconst logger = new SmartLogger({ logLevel: \"info\" });\n\n// Log messages\nlogger.debug(\"This is a debug message\"); // Won't log (logLevel is 'info')\nlogger.info(\"This is an info message\"); // Will log\nlogger.warn(\"This is a warning message\"); // Will log\nlogger.error(\"This is an error message\"); // Will log\n```\n\n### Set Log Level Dynamically\n\nYou can change the log level at runtime:\n\n```javascript\nlogger.setLogLevel(\"debug\"); // Now debug logs will be shown\nlogger.debug(\"This is a debug message\"); // Will log\n```\n\n---\n\n## Smart Logger Instance\n\n### `new SmartLogger(options)`\n\nCreates a new logger instance.\n\n- **options** (Object):\n  - `logLevel` (String): Minimum log level to display. Default: `'info'`.\n  - Possible values: `'debug'`, `'info'`, `'warn'`, `'error'`.\n\n### Methods\n\n- `logger.debug(message, ...args)`: Logs a debug message.\n- `logger.info(message, ...args)`: Logs an info message.\n- `logger.warn(message, ...args)`: Logs a warning message.\n- `logger.error(message, ...args)`: Logs an error message.\n- `logger.setLogLevel(level)`: Sets the minimum log level.\n\n## Examples\n\n### Browser Example\n\n```html\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Logger Test</title>\n    <script src=\"https://unpkg.com/@beherapratyush/logger/dist/smart-logger.js\"></script>\n    <script>\n      const logger = new SmartLogger({ logLevel: \"debug\" });\n\n      logger.debug(\"This is a debug message\");\n      logger.info(\"This is an info message\");\n      logger.warn(\"This is a warning message\");\n      logger.error(\"This is an error message\");\n    </script>\n  </head>\n  <body>\n    <h1>Check the console for logs!</h1>\n  </body>\n</html>\n```\n\n### Node Example\n\n```\nconst SmartLogger = require('@beherapratyush/logger');\nconst logger = new SmartLogger({ logLevel: 'warn' });\n\nlogger.debug('This is a debug message'); // Won't log\nlogger.info('This is an info message'); // Won't log\nlogger.warn('This is a warning message'); // Will log\nlogger.error('This is an error message'); // Will log\n```\n\n---\n\n## Building the Package\n\nIf you want to build the package locally:\n\n#### 1. Clone the repository:\n\n```bash\ngit clone https://github.com/pratyushbehera/smart-logger.git\ncd smart-logger\n```\n\n#### 2. Install dependencies:\n\n```\nnpm install\n```\n\n#### 3. Build the package:\n\n```\nnpm run build\n```\n\nThis will generate a `dist` folder containing the bundled and minified files.\n\n---\n\n## Contributing\n\nContributions are welcome! Follow these steps:\n\n#### 1. Fork the repository.\n\n#### 2. Create a new branch:\n\n```bash\ngit checkout -b feature/your-feature\n```\n\n#### 3.Make your changes and commit them:\n\n```bash\ngit commit -m \"Add your feature\"\n```\n\n#### 4.Push to the branch:\n\n```bash\ngit push origin feature/your-feature\n```\n\n#### 5.Open a pull request.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Support\n\nIf you find this package useful, please consider giving it a ⭐️ on [GitHub](https://github.com/pratyushbehera/smart-logger).\n\nFor issues or feature requests, please open an issue on the [GitHub repository](https://github.com/pratyushbehera/smart-logger/issues).\n\n---\n\nEnjoy logging! 🚀\n","readmeFilename":"README.md"}