{"id":29016606,"url":"https://github.com/chef/opscoderl_wm","last_synced_at":"2025-10-18T04:37:00.065Z","repository":{"id":9155356,"uuid":"10949801","full_name":"chef/opscoderl_wm","owner":"chef","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-25T07:22:53.000Z","size":74,"stargazers_count":2,"open_issues_count":1,"forks_count":4,"subscribers_count":67,"default_branch":"main","last_synced_at":"2025-08-12T18:50:56.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","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/chef.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}},"created_at":"2013-06-25T20:44:52.000Z","updated_at":"2025-07-25T07:22:57.000Z","dependencies_parsed_at":"2024-07-26T08:55:23.290Z","dependency_job_id":null,"html_url":"https://github.com/chef/opscoderl_wm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chef/opscoderl_wm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fopscoderl_wm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fopscoderl_wm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fopscoderl_wm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fopscoderl_wm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chef","download_url":"https://codeload.github.com/chef/opscoderl_wm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fopscoderl_wm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270288760,"owners_count":24558854,"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-08-13T02:00:09.904Z","response_time":66,"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":[],"created_at":"2025-06-25T22:30:56.620Z","updated_at":"2025-10-18T04:36:55.030Z","avatar_url":"https://github.com/chef.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opscoderl_wm #\n\nOpscode helpers for Webmachine. Here you will find the following modules:\n\n## License\n\nAll files in the repository are licensed under the Apache 2.0 license. If any\nfile is missing the License header it should assume the following is attached;\n\n```\nCopyright 2014 Chef Software Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n## oc_wm_request\n\nHelper functions for use in a wm callback module.\n\nIncludes `make_req_id/0` for generating a random request id,\n`read_req_id/2` for reading the req id out of a header and generating\none if none is found, and `add_notes/2` for annotating req data for\nuse in logging.\n\n## oc_wm_request_logger\n\nA request logger for use with Webmachine logging hooks. To use this\nlogger, add the following to your application's config:\n\n```\n  {webmachine, [\n          {log_handlers, [\n               {oc_wm_request_logger, [\n                       {file, \"requests.log\"},\n                       {file_size, 100},\n                       {files, 10},\n                       {annotations, [req_id, org_name, msg, darklaunch, perf_stats]}\n                       ]\n                      }]}]\n      }\n```\n\nThe `annotations` key is optional. If you specify annotation keys,\nthen values corresponding to those keys found in wm request's `notes`\nfield are extracted and integrated into the log entry.\n\n### How webmachine starts a pluggable logger\n\nThe mechanism by which log handlers are added to wm's event logger is\na bit twisty. Here's an overview to help trace it down in the code if\nyou need it.\n\nWebmachine starts your logger in `webmachine_app.erl` where a call to\n`supervisor:start_child(webmachine_logger_watcher_sup, ...)` is made\nfor each handler found in app config. That call starts a new\n`webmachine_logger_watcher` for each handler. In the init of\n`webmachine_logger_watcher` you will find a call to\n`gen_event:add_sup_handler` on the `webmachine_log_event` event logger\nwhich is where your handler is actually installed.\n\n# Guidelines for opscoderl helper repos #\n\nThis repository is the first in what we hope will be a useful pattern\nfor collecting reusable Erlang code. The idea is to balance the\nextremes of a dumping ground \"commons\" repo that would force consumers\nto pull in dependencies that they won't use with a proliferation of\nsingle module repos (hi, that's what this is for now, sorry).\n\nHelper repos should follow these guidelines:\n\n1. Be named `opscoderl_$BLAH` where `$BLAH` names a dependency that\n   is wrapped (e.g. this repo with folsom) OR a well defined bit of\n   functionality. I think we will soon have an `opscoderl_json` repo\n   that pulls in jiffy and ej.\n\n2. Minimal focused set of dependencies. A dependency is reasonable if\n   any user of the helper will want the dependency. Conversely, a\n   dependency that covers a small or rare use case should be given\n   extra scrutiny. As a consumer of a helper, it is unpleasant to have\n   to pull in a dependency that you aren't going to use. A tag or git\n   SHA should be used by the helper to peg the version of the\n   dependency.\n\n3. Modules should be prefixed with `oc_`. Care should be taken not to\n   conflict with modules from other opscoderl helper applications.\n\n4. Open source and not product specific. May contain some\n   Opscode-isms, but the intention is that these helpers can be\n   generally useful (like erlware_commons).\n\n# Guidelines for using opscoderl helpers #\n\n1. Contrary to normal practice, avoid specifying the dependencies\n   provided by the helper even if you use them directly. For example,\n   depend only on `opscoderl_folsom` and use `oc_folsom` and\n   `folsom`. This allows the version of the wrapped dependencies to be\n   controlled by the helper app. Care needs to be taken in managing\n   OTP release when a non-helper app shares a dependency with a\n   helper. We may need to add direct deps in some cases to get the\n   right behavior out of rebar and lock deps.\n\n## License ##\n\n|                      |                                          |\n|:---------------------|:-----------------------------------------|\n| **Copyright:**       | Copyright (c) 2013 Opscode, Inc.\n| **License:**         | Apache License, Version 2.0\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchef%2Fopscoderl_wm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchef%2Fopscoderl_wm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchef%2Fopscoderl_wm/lists"}