{"id":24904999,"url":"https://github.com/sumit-behera-in/gologger","last_synced_at":"2025-03-27T21:26:56.136Z","repository":{"id":269331159,"uuid":"906929711","full_name":"sumit-behera-in/goLogger","owner":"sumit-behera-in","description":"This is a custom logging system designed to handle and manage logs across all levels.","archived":false,"fork":false,"pushed_at":"2024-12-29T18:48:09.000Z","size":383,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T23:46:10.632Z","etag":null,"topics":["golang","golang-library","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","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/sumit-behera-in.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":"2024-12-22T10:40:36.000Z","updated_at":"2024-12-30T07:09:21.000Z","dependencies_parsed_at":"2024-12-23T06:57:36.481Z","dependency_job_id":null,"html_url":"https://github.com/sumit-behera-in/goLogger","commit_stats":null,"previous_names":["sumit-behera-in/go-logger","sumit-behera-in/go_logger"],"tags_count":6,"template":false,"template_full_name":"sumit-behera-in/go-repo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit-behera-in%2FgoLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit-behera-in%2FgoLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit-behera-in%2FgoLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumit-behera-in%2FgoLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sumit-behera-in","download_url":"https://codeload.github.com/sumit-behera-in/goLogger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245926144,"owners_count":20695016,"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":["golang","golang-library","logging"],"created_at":"2025-02-01T23:46:16.443Z","updated_at":"2025-03-27T21:26:56.092Z","avatar_url":"https://github.com/sumit-behera-in.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goLogger\n\n`goLogger` is a Go package that provides a flexible and efficient logging mechanism. It supports logging to files with optional buffering and offers integration with multiple timezones for precise timestamping.\n\n## Features\n\n- Logs messages at various levels: `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`.\n- Buffered logging to improve performance.\n- Supports rotation of log files with customizable backup count.\n- Configurable timezone for timestamps.\n- Graceful handling of fatal logs.\n\n## Installation\n\nTo install the package, run:\n```bash\ngo get github.com/sumit-behera-in/goLogger\n```\n\n## Usage\n\n### Importing the Package\n```go\nimport \"github.com/sumit-behera-in/goLogger\"\n```\n\n### Creating a Logger Instance\nTo create a logger instance, use `NewLogger`:\n```go\nlogger, err := goLogger.NewLogger(\"MyApp\", \"./logs\", 100, 5, \"IST\")\nif err != nil {\n    log.Fatalf(\"Failed to create logger: %v\", err)\n}\ndefer logger.Close()\n```\n\nParameters:\n- `appName`: Name of your application.\n- `logFileDir`: Directory for log files. Leave empty to log to stdout.\n- `bufferSize`: Number of logs to buffer before flushing to file.\n- `logBackupCount`: Number of rotated log files to keep.\n- `timeZone`: Timezone for timestamps (see [Supported Timezones](#supported-timezones)).\n\n### Logging Messages\n```go\nlogger.Debug(\"This is a debug message\")\nlogger.Infof(\"Starting server on port %d\", 8080)\nlogger.Warn(\"Low disk space\")\nlogger.Error(\"Failed to connect to database\")\nlogger.Fatal(\"Critical error. Shutting down.\")\n```\n\n### Supported Timezones\nThe following timezones are supported for timestamping:\n\n- **ACST**: Australia/Adelaide\n- **AEST**: Australia/Sydney\n- **AKST**: America/Anchorage\n- **AST**: Asia/Riyadh\n- **AWST**: Australia/Perth\n- **BST**: Europe/London\n- **CCT**: Asia/Shanghai\n- **CDT**: America/Chicago\n- **CET**: Europe/Paris\n- **CST**: America/Chicago\n- **EAT**: Africa/Nairobi\n- **EDT**: America/New_York\n- **EET**: Europe/Bucharest\n- **EST**: America/New_York\n- **GMT**: Europe/London\n- **HKT**: Asia/Hong_Kong\n- **HST**: Pacific/Honolulu\n- **IST**: Asia/Calcutta\n- **JST**: Asia/Tokyo\n- **KST**: Asia/Seoul\n- **MDT**: America/Denver\n- **MSK**: Europe/Moscow\n- **MST**: America/Denver\n- **NZST**: Pacific/Auckland\n- **PDT**: America/Los_Angeles\n- **PST**: America/Los_Angeles\n- **SAST**: Africa/Johannesburg\n- **SGT**: Asia/Singapore\n- **UTC**: UTC\n- **WAT**: Africa/Lagos\n\nIf an invalid or unsupported timezone is provided, the logger defaults to the system's local timezone.\n\n## Example\n```go\npackage main\n\nimport (\n    \"github.com/sumit-behera-in/goLogger\"\n)\n\nfunc main() {\n    logger, err := goLogger.NewLogger(\"ExampleApp\", \"./logs\", 100, 3, \"UTC\")\n    if err != nil {\n        panic(err)\n    }\n    defer logger.Close()\n\n    logger.Info(\"Application started\")\n    logger.Debug(\"This is a debug log\")\n    logger.Warn(\"Warning: High memory usage\")\n    logger.Error(\"An error occurred\")\n}\n```\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumit-behera-in%2Fgologger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsumit-behera-in%2Fgologger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumit-behera-in%2Fgologger/lists"}