{"id":21423803,"url":"https://github.com/ossystems/logging_content","last_synced_at":"2025-10-06T01:39:34.384Z","repository":{"id":39888693,"uuid":"406472308","full_name":"OSSystems/logging_content","owner":"OSSystems","description":"Some utilities for logging data and results of operations","archived":false,"fork":false,"pushed_at":"2022-06-06T20:37:33.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-28T12:34:21.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OSSystems.png","metadata":{"files":{"readme":"README.org","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}},"created_at":"2021-09-14T18:02:15.000Z","updated_at":"2022-05-11T14:08:05.000Z","dependencies_parsed_at":"2022-09-14T03:23:06.984Z","dependency_job_id":null,"html_url":"https://github.com/OSSystems/logging_content","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Flogging_content","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Flogging_content/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Flogging_content/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Flogging_content/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OSSystems","download_url":"https://codeload.github.com/OSSystems/logging_content/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243933370,"owners_count":20370988,"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":"2024-11-22T21:18:14.095Z","updated_at":"2025-10-06T01:39:29.360Z","avatar_url":"https://github.com/OSSystems.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+Title: logging_content\n\nThis is a library intendeted for making logging intermediary results of operations simpler,\nwhile also adding context to the current state of operations.\nHere are some code samples to show the library could be used:\n\nStart by adding the macro calls to where you wan't it's definition in:\n#+BEGIN_SRC rust\n  logging_content::trait_LogContent!();\n  logging_content::trait_LogDisplay!();\n  logging_content::impl_Result!();\n#+END_SRC\n\nAnd define how you wan't kown types to be displayed when logging:\n#+BEGIN_SRC rust\nimpl\u003cE: std::error::Error\u003e LogDisplay for E {\n    fn as_log_display(\u0026self, _: logging_content::Level) -\u003e String {\n        format!(\"{} ({:?})\", self, self)\n    }\n}\n#+END_SRC\n\nThen you can easily add some log calls without changing anything inside your `Result` type.\n#+BEGIN_SRC rust\n  // Import LogContent trait from where it was defined\n  use utils::log::LogContent;\n\n  let mut input = utils::io::timed_buf_reader(\n      chunk_size,\n      fs::File::open(source).log_error_msg(\"failed to open source file\")?,\n  );\n  input.seek(SeekFrom::Start(skip)).log_error_msg(\"failed to seek source file\")?;\n  let mut output = utils::io::timed_buf_writer(\n      chunk_size,\n      fs::OpenOptions::new()\n          .read(true)\n          .write(true)\n          .truncate(truncate)\n          .open(device)\n          .log_error_msg(\"failed to open output file\")?,\n  );\n  output.seek(SeekFrom::Start(seek)).log_error_msg(\"failed to seek output file\")?;\n#+END_SRC\n\nThe [[examples/result_logging.rs][result_logging]] example shows a more self contained example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossystems%2Flogging_content","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossystems%2Flogging_content","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossystems%2Flogging_content/lists"}