{"id":28511226,"url":"https://github.com/harshdev1809/logmux","last_synced_at":"2026-03-14T13:09:16.106Z","repository":{"id":293518178,"uuid":"984339662","full_name":"HarshDev1809/logmux","owner":"HarshDev1809","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-05T16:19:24.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T11:42:22.538Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HarshDev1809.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-05-15T19:14:02.000Z","updated_at":"2025-06-05T15:38:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"afcd2e33-dccf-4aa5-9571-e59630146ccb","html_url":"https://github.com/HarshDev1809/logmux","commit_stats":null,"previous_names":["harshdev1809/logmux"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HarshDev1809/logmux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshDev1809%2Flogmux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshDev1809%2Flogmux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshDev1809%2Flogmux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshDev1809%2Flogmux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarshDev1809","download_url":"https://codeload.github.com/HarshDev1809/logmux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshDev1809%2Flogmux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265224098,"owners_count":23730338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-06-08T23:38:16.036Z","updated_at":"2026-03-14T13:09:16.069Z","avatar_url":"https://github.com/HarshDev1809.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LogMux\n\nA flexible and customizable logging utility for Node.js applications, supporting both ESM and CommonJS modules, with TypeScript support. LogMux provides a simple way to log messages with customizable colors, timestamps, labels, and file logging capabilities.\n\n## Features\n\n- **Customizable Logging**: Configure log colors, timestamps, and labels.\n- **Multiple Log Types**: Supports standard logs (`Log`), error logs (`ErrorLog`), and warning logs (`WarnLog`).\n- **Timestamp Formats**: Choose between Unix timestamp or ISO format.\n- **File Logging**: Optionally save logs to a file.\n- **Color Support**: ANSI color codes for console output.\n- **TypeScript Support**: Fully typed with TypeScript definitions.\n- **Dual Module Support**: Compatible with both ESM and CommonJS.\n- **Configurable Labels**: Include or exclude labels, with optional uppercase formatting.\n\n## Installation\n\nInstall LogMux via npm:\n\n```bash\nnpm install logmux\n```\n\n## Usage\n\n### Importing LogMux\n\n#### ESM\n```javascript\nimport LogMux from 'logmux';\n```\n\n#### CommonJS\n```javascript\nconst LogMux = require('logmux');\n```\n\n### Basic Example\n\n```javascript\nconst logger = new LogMux({\n  textColour: 'blue',\n  errorColour: 'red',\n  warnColour: 'yellow',\n  includeLabel: true,\n  includeTimeStamp: true,\n  timeStampFormat: 'iso',\n  recordFile: true,\n  uppercaseLabel: true,\n});\n\n// Standard log\nawait logger.Log('This is an info message');\n\n// Error log\nawait logger.ErrorLog('This is an error message');\n\n// Warning log\nawait logger.WarnLog('This is a warning message');\n```\n\n### Configuration Options\n\nWhen creating a `LogMux` instance, you can pass a configuration object with the following properties:\n\n| Option              | Type      | Default       | Description                                                                 |\n|---------------------|-----------|---------------|-----------------------------------------------------------------------------|\n| `textColour`        | `string`  | `'white'`     | ANSI color for standard logs (e.g., `'blue'`, `'green'`).                   |\n| `errorColour`       | `string`  | `'red'`       | ANSI color for error logs.                                                  |\n| `warnColour`        | `string`  | `'yellow'`    | ANSI color for warning logs.                                                |\n| `includeLabel`      | `boolean` | `true`        | Include a label (e.g., `[INFO]`, `[ERROR]`) in the log.                     |\n| `includeTimeStamp`  | `boolean` | `true`        | Include a timestamp in the log.                                             |\n| `timeStampFormat`   | `string`  | `'unix'`      | Timestamp format: `'unix'` (milliseconds) or `'iso'` (ISO 8601).            |\n| `recordFile`        | `boolean` | `false`       | Save logs to a file (`logs.txt` by default).                                |\n| `uppercaseLabel`    | `boolean` | `false`       | Convert labels to uppercase (e.g., `[INFO]` instead of `[info]`).           |\n\n### Example with Custom Configuration\n\n```javascript\nconst logger = new LogMux({\n  textColour: 'cyan',\n  timeStampFormat: 'unix',\n  recordFile: true,\n  uppercaseLabel: true,\n});\n\nawait logger.Log('Custom log message', 'CUSTOM');\n// Output: 1746654321000 [CUSTOM] - Custom log message (in cyan)\nawait logger.ErrorLog('Something went wrong');\n// Output: 1746654321000 [ERROR] - Something went wrong (in red)\n```\n\n### TypeScript Usage\n\nLogMux is fully typed and works seamlessly with TypeScript. Here's an example:\n\n```typescript\nimport LogMux from 'logmux';\n\nconst logger = new LogMux({\n  textColour: 'green',\n  timeStampFormat: 'iso',\n  recordFile: true,\n});\n\nasync function main() {\n  await logger.Log('Hello, TypeScript!', 'INFO');\n  await logger.WarnLog({ warning: 'Low battery' }, 'BATTERY');\n  await logger.ErrorLog(new Error('Critical failure'), 'CRITICAL');\n}\n\nmain();\n```\n\n### File Logging\n\nWhen `recordFile` is set to `true`, logs are saved to `logs.txt` in the project directory. You can customize the file path by modifying the `logToFile` function in `src/utils.ts` if needed.\n\n## API\n\n### `LogMux` Class\n\n#### Constructor\n```javascript\nconst logger = new LogMux(config);\n```\n\n#### Methods\n- **`Log(message: any, label?: string): Promise\u003cvoid\u003e`**\n  Logs a standard message with optional custom label.\n- **`ErrorLog(message: any, label?: string): Promise\u003cvoid\u003e`**\n  Logs an error message with optional custom label.\n- **`WarnLog(message: any, label?: string): Promise\u003cvoid\u003e`**\n  Logs a warning message with optional custom label.\n\n## Supported Colors\n\nLogMux supports the following ANSI colors for console output:\n\n- `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`\n- `brightBlack`, `brightRed`, `brightGreen`, `brightYellow`, `brightBlue`, `brightMagenta`, `brightCyan`, `brightWhite`\n\n## Development\n\nTo contribute to LogMux or build it locally:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/HarshDev1809/logmux.git\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Build the project:\n   ```bash\n   npm run build\n   ```\n\n4. Run tests (if available):\n   ```bash\n   npm test\n   ```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please submit a pull request or open an issue on the [GitHub repository](https://github.com/HarshDev1809/logmux.git) for bug reports, feature requests, or suggestions.\n\n## Contact\n\nFor questions or support, please open an issue on the [GitHub repository](https://github.com/HarshDev1809/logmux.git) or contact the maintainers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshdev1809%2Flogmux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharshdev1809%2Flogmux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshdev1809%2Flogmux/lists"}