{"id":32153980,"url":"https://github.com/xuestrange/log2file.jl","last_synced_at":"2025-10-21T11:48:50.450Z","repository":{"id":183180288,"uuid":"669735357","full_name":"xuestrange/Log2file.jl","owner":"xuestrange","description":"Log message to local file instantly","archived":false,"fork":false,"pushed_at":"2025-09-12T08:18:29.000Z","size":52,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-12T22:12:16.214Z","etag":null,"topics":["julia","julia-package","logging"],"latest_commit_sha":null,"homepage":"","language":"Julia","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/xuestrange.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-23T09:00:13.000Z","updated_at":"2025-09-12T08:15:09.000Z","dependencies_parsed_at":"2025-08-31T11:15:27.292Z","dependency_job_id":"ac58dcee-4571-4821-89af-288ce52a638a","html_url":"https://github.com/xuestrange/Log2file.jl","commit_stats":null,"previous_names":["xuestrange/log2file","xuestrange/log2file.jl"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/xuestrange/Log2file.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuestrange%2FLog2file.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuestrange%2FLog2file.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuestrange%2FLog2file.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuestrange%2FLog2file.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuestrange","download_url":"https://codeload.github.com/xuestrange/Log2file.jl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuestrange%2FLog2file.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280256195,"owners_count":26299341,"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-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["julia","julia-package","logging"],"created_at":"2025-10-21T11:48:45.129Z","updated_at":"2025-10-21T11:48:50.441Z","avatar_url":"https://github.com/xuestrange.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log2file\n\n[![CI](https://github.com/xuestrange/Log2file/actions/workflows/CI.yml/badge.svg)](https://github.com/xuestrange/Log2file/actions/workflows/CI.yml)\n[![Julia](https://img.shields.io/badge/julia-%E2%89%A5%201.6-blue.svg)](https://julialang.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA lightweight, flexible logging system for Julia that makes it easy to write formatted, timestamped logs to files. Perfect for debugging, tracking experiments, or monitoring long-running processes.\n\n🚀 **Key Features**:\n- Simple API with four core macros: `@init_log`, `@section`, `@log`, `@logm`\n- Automatic timestamping and centered section headers\n- Configurable line length and append/overwrite modes\n- Indented multi-line message support\n- Clean and readable log file formatting\n\n## Install\n```Julia\n# enter REPL, enter pkg mode\npkg\u003e add Log2file\n```\n## Usage\n\nLog2file provides a simple logging system. First create a logger, then use the logging macros:\n\n```julia\nusing Log2file\n\n# Create a logger with line_length=40, logfile_path=\"log.txt\", append=true\n# The log file is not initialized only if you run @init_log below\nlogger = Logger(40, \"log.txt\", true)\n\n# Initialize the log file in your disk\n@init_log logger \"My Program\"\n\n# Add a section header\n@section logger \"Data Processing\"\n\n# Log single messages\nx = [1, 2, 3]\n@log logger \"Processing array: $x\"\n\n# Log multiple messages with indentation\ny = randn(2, 2)\n@logm logger \"Step 1: Load data\", \"x = $x\", \"y = $y\"\n```\n## Example Output in REPL\n\n```julia\njulia\u003e logger = Logger(40, \"log.txt\", true)\n[ Info: Created logger with:\n[ Info: Line length: 40\n[ Info: Log file path: /Users/xue/Downloads/Log2file.jl/log.txt\n[ Info: Write mode: append\n\njulia\u003e x = [1, 2, 3]\njulia\u003e y = randn(2, 2)\njulia\u003e @init_log logger \"My Program\"\n2023-10-16 12:02:34 ============My Program=============\n\njulia\u003e @section logger \"Data Processing\"\n2023-10-16 12:02:34 ==========Data Processing==========\n\njulia\u003e @log logger \"Processing array: $x\"\n2023-10-16 12:02:34 Processing array: [1, 2, 3]\n\njulia\u003e @logm logger \"Step 1: Load data\", \"x = $x\", \"y = $y\"\n2023-10-16 12:02:34 Step 1: Load data\n                    x = [1, 2, 3]\n                    y = [-0.12 0.45; 1.23 -0.67]\n```\n\n## File Output (`log.txt`) Meantime\n```\n2023-10-16 12:02:34 ============My Program=============\n2023-10-16 12:02:34 ==========Data Processing==========\n2023-10-16 12:02:34 Processing array: [1, 2, 3]\n2023-10-16 12:02:34 Step 1: Load data\n                    x = [1, 2, 3]\n                    y = [-0.12 0.45; 1.23 -0.67]\n```\n\n## API Reference\n\nHere is a summary of the functions and macros provided by Log2file.\n\n### `Logger`\n```julia\nLogger(40, \"\", true)\n```\nCreates a logger configuration object that holds settings like `line_length=40, logfile_path=\"log.txt\", append=true`, where the complete path is `joinpath(pwd(), \"log.txt\")`\n\n### `@init_log`\n```julia\n@init_log(logger, title=\"PROGRAM BEGINS\")\n```\nInitializes the log file with a formatted header. This will create the file if it doesn't exist.\n\n### `@section`\n```julia\n@section(logger, title)\n```\nAdds a formatted section header to the log file, helping to organize log entries.\n\n### `@log`\n```julia\n@log(logger, message)\n```\nWrites a single, timestamped message to the log file.\n\n### `@logm`\n```julia\n@logm(logger, messages...)\n```\nWrites multiple messages to the log file. The first message is timestamped, and subsequent messages are indented for readability.\n\n## Why Log2file?\n\n- **Simple Yet Powerful**: Just a few macros to remember, but highly configurable when you need it\n- **Flexible Configuration**: Easily configurable logging settings to match your needs\n- **Beautiful Output**: Automatic formatting and indentation make logs easy to read\n- **Performance**: Minimal overhead, efficient file operations\n- **Production Ready**: Thread-safe, handles file creation/permissions, proper error handling\n\n## Contributing\n\nContributions are welcome! Here are some ways you can contribute:\n\n- Report bugs by opening an issue\n- Suggest new features or improvements\n- Submit pull requests\n- Improve documentation\n- Share your use cases\n\nPlease check the [issues page](https://github.com/xuestrange/Log2file/issues) for open tasks or create a new one to discuss your ideas.\n\n## License\n\nThis project is licensed under the MIT License.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuestrange%2Flog2file.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuestrange%2Flog2file.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuestrange%2Flog2file.jl/lists"}