{"id":45791376,"url":"https://github.com/sheikhnz/traillog","last_synced_at":"2026-02-26T12:01:47.326Z","repository":{"id":283215474,"uuid":"935041439","full_name":"sheikhnz/traillog","owner":"sheikhnz","description":"Traillog is a simple, colorful logging utility for Node.js applications. It provides an easy way to add formatted, color-coded logs with timestamps and caller information for better debugging and log readability.","archived":false,"fork":false,"pushed_at":"2025-02-18T20:11:54.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-04T06:45:27.058Z","etag":null,"topics":["debugging","logging","npm-package"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/traillog","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/sheikhnz.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}},"created_at":"2025-02-18T20:08:20.000Z","updated_at":"2025-02-22T12:49:07.000Z","dependencies_parsed_at":"2025-03-19T05:48:06.732Z","dependency_job_id":null,"html_url":"https://github.com/sheikhnz/traillog","commit_stats":null,"previous_names":["sheikhmohdnazmulhasan/traillog","sheikhnz/traillog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sheikhnz/traillog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheikhnz%2Ftraillog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheikhnz%2Ftraillog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheikhnz%2Ftraillog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheikhnz%2Ftraillog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheikhnz","download_url":"https://codeload.github.com/sheikhnz/traillog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheikhnz%2Ftraillog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29858461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T08:51:08.701Z","status":"ssl_error","status_checked_at":"2026-02-26T08:50:19.607Z","response_time":89,"last_error":"SSL_read: 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":["debugging","logging","npm-package"],"created_at":"2026-02-26T12:01:43.200Z","updated_at":"2026-02-26T12:01:47.315Z","avatar_url":"https://github.com/sheikhnz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traillog\n\nTraillog is a simple, colorful logging utility for Node.js applications. It provides an easy way to add formatted, color-coded logs with timestamps and caller information for better debugging and log readability.\n\n## Features\n\n- Color-coded log messages using chalk\n- Timestamp for each log entry\n- Caller's file and line number for easy tracing\n- Support for different log levels: SUCCESS, ERROR, WARN, and INFO\n- Optional metadata logging in JSON format\n\n## Installation\n\nTo install Traillog, run the following command in your project directory:\n\n```\nnpm install traillog\n```\n\n## Usage\n\nFirst, import the logger from traillog in your JavaScript or TypeScript file:\n\n```javascript\nimport logger from \"traillog\";\n```\n\nThen, you can use the different logging methods:\n\n```javascript\n// Log a success message\nlogger.success(\"Operation completed successfully\");\n\n// Log an error message\nlogger.error(\"An error occurred\", { errorCode: 500 });\n\n// Log a warning message\nlogger.warn(\"This is a warning\");\n\n// Log an informational message\nlogger.info(\"This is an informational message\", { user: \"John Doe\" });\n```\n\nEach logging method accepts two parameters:\n\n1. `message` (required): The main log message as a string.\n2. `meta` (optional): An object containing additional metadata to be logged.\n\n## Output\n\nThe log output will be formatted as follows:\n\n```\n[TIMESTAMP] [LOG_LEVEL] (FILE:LINE): MESSAGE\nMETADATA (if provided)\n```\n\nFor example:\n\n```\n[2023-05-20T12:34:56.789Z] [SUCCESS] (src/app.ts:42): Operation completed successfully\n[2023-05-20T12:34:57.123Z] [ERROR] (src/app.ts:45): An error occurred\n{\n  \"errorCode\": 500\n}\n```\n\n## API Reference\n\nThe `logger` object exposes four main methods for logging:\n\n### logger.success(message, meta?)\n\nLogs a success message in green.\n\n- `message` (string): The success message to log.\n- `meta` (object, optional): Additional metadata to log.\n\nExample:\n\n```javascript\nlogger.success(\"Data saved successfully\", { id: 123 });\n```\n\n### logger.error(message, meta?)\n\nLogs an error message in red.\n\n- `message` (string): The error message to log.\n- `meta` (object, optional): Additional metadata to log, such as error details.\n\nExample:\n\n```javascript\nlogger.error(\"Failed to connect to database\", { errorCode: \"DB_001\" });\n```\n\n### traillog.warn(message, meta?)\n\nLogs a warning message in yellow.\n\n- `message` (string): The warning message to log.\n- `meta` (object, optional): Additional metadata to log.\n\nExample:\n\n```javascript\nlogger.warn(\"Deprecated function called\", { function: \"oldMethod\" });\n```\n\n### traillog.info(message, meta?)\n\nLogs an informational message in blue.\n\n- `message` (string): The informational message to log.\n- `meta` (object, optional): Additional metadata to log.\n\nExample:\n\n```javascript\nlogger.info(\"User logged in\", { userId: \"user123\", timestamp: Date.now() });\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheikhnz%2Ftraillog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheikhnz%2Ftraillog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheikhnz%2Ftraillog/lists"}