{"id":28348887,"url":"https://github.com/amarsinghrathour/fastlog","last_synced_at":"2025-07-24T01:06:34.273Z","repository":{"id":247951106,"uuid":"821290347","full_name":"amarsinghrathour/fastlog","owner":"amarsinghrathour","description":"fastlog is a high-performance, lightweight logging package for Go. It offers a simple API, flexible configuration, and thread-safe operations, making it ideal for both small scripts and large-scale systems. ","archived":false,"fork":false,"pushed_at":"2024-07-16T18:42:56.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T04:39:50.281Z","etag":null,"topics":["concurrent","fastlog","go","golang","high-performance","lightweight","log","logger","logging","thread-safe"],"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/amarsinghrathour.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":"2024-06-28T08:04:23.000Z","updated_at":"2024-07-16T18:41:23.000Z","dependencies_parsed_at":"2025-06-22T04:31:23.151Z","dependency_job_id":"7674d262-47df-4411-94d9-719ca52228fa","html_url":"https://github.com/amarsinghrathour/fastlog","commit_stats":null,"previous_names":["amarsinghrathour/fastlog"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/amarsinghrathour/fastlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarsinghrathour%2Ffastlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarsinghrathour%2Ffastlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarsinghrathour%2Ffastlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarsinghrathour%2Ffastlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amarsinghrathour","download_url":"https://codeload.github.com/amarsinghrathour/fastlog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarsinghrathour%2Ffastlog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266775383,"owners_count":23982273,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["concurrent","fastlog","go","golang","high-performance","lightweight","log","logger","logging","thread-safe"],"created_at":"2025-05-27T19:11:03.288Z","updated_at":"2025-07-24T01:06:34.251Z","avatar_url":"https://github.com/amarsinghrathour.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastlog\n\n`fastlog` is a high-performance logging package for Go, designed to be extremely fast, efficient, and suitable for high-performance applications. It supports logging to both files and standard output, with features such as buffering, non-blocking I/O, periodic flushing, log rotation, and configurable log levels.\n\n## Features\n\n- **Log Levels**: Supports DEBUG, INFO, WARN, ERROR, and FATAL levels.\n- **Buffering**: Uses a buffer to minimize I/O operations.\n- **Non-blocking I/O**: Log messages are sent to a channel and processed by a separate goroutine.\n- **Periodic Flushing**: Flushes logs every 5 seconds.\n- **Log Rotation**: Automatically rotates log files when they exceed a predefined size.\n- **Configurable Output**: Logs can be written to a file or standard output based on configuration.\n- **Structured Logging**: Supports structured logging and JSON formatted logs.\n\n## Installation\n\nTo install `fastlog`, run:\n\n```sh\ngo get github.com/amarsinghrathour/fastlog\n```\n## Usage\nHere's an example of how to use fastlog:\n\n```\n    package main\n\n    import (\n        \"log\"\n        \"os\"\n        \"path/filepath\"\n        \"time\"\n    \n        \"github.com/yourusername/fastlog\"\n    )\n\n    func main() {\n        logDir := \"logs\"\n        baseLogFileName := filepath.Join(logDir, \"app.log\")\n    \n        err := os.MkdirAll(logDir, 0755)\n        if err != nil {\n            log.Fatalf(\"Failed to create log directory: %v\", err)\n        }\n    \n        // Configure to log to a file\n        loggerConfig := fastlog.LoggerConfig{\n            Level:       fastlog.DEBUG,\n            FilePath:    baseLogFileName,\n            RotationDir: logDir,\n            Stdout:      false, // Set to true to log to stdout instead of a file\n            JSONFormat:  true,  // Set to true to enable JSON formatted logs\n        }\n    \n        logger, err := fastlog.NewLogger(loggerConfig)\n        if err != nil {\n            log.Fatalf(\"Failed to create logger: %v\", err)\n        }\n        defer logger.Close()\n    \n        // Log various messages\n        logger.Debug(\"This is a debug message\", \"key1\", \"value1\")\n        logger.Info(\"This is an info message\", \"key2\", \"value2\")\n        logger.Warn(\"This is a warning message\", \"key3\", \"value3\")\n        logger.Error(\"This is an error message\", \"key4\", \"value4\")\n    \n        // Simulate some work to generate logs over time\n        for i := 0; i \u003c 10; i++ {\n            logger.Info(\"Working on task\", \"iteration\", i)\n            time.Sleep(1 * time.Second)\n        }\n    \n        // Log a fatal message (this will terminate the program)\n        logger.Fatal(\"This is a fatal message\", \"key5\", \"value5\")\n    }\n\n\n\n```\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n[![Go Reference](https://pkg.go.dev/badge/github.com/amarsinghrathour/fastlog.svg)](https://pkg.go.dev/github.com/amarsinghrathour/fastlog)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarsinghrathour%2Ffastlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famarsinghrathour%2Ffastlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarsinghrathour%2Ffastlog/lists"}