{"id":15502039,"url":"https://github.com/prodis/log-me","last_synced_at":"2025-07-08T22:02:09.566Z","repository":{"id":1614888,"uuid":"2259490","full_name":"prodis/log-me","owner":"prodis","description":"A simple way to configure log in your gem.","archived":false,"fork":false,"pushed_at":"2015-12-15T04:40:23.000Z","size":38,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T02:16:45.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/log-me","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nlplab/brat","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prodis.png","metadata":{"files":{"readme":"README.rdoc","changelog":"CHANGELOG.rdoc","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-08-24T04:06:11.000Z","updated_at":"2020-04-11T14:31:39.000Z","dependencies_parsed_at":"2022-08-19T06:22:07.301Z","dependency_job_id":null,"html_url":"https://github.com/prodis/log-me","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Flog-me","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Flog-me/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Flog-me/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Flog-me/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prodis","download_url":"https://codeload.github.com/prodis/log-me/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337599,"owners_count":21414097,"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-10-02T09:07:18.736Z","updated_at":"2025-04-22T22:43:24.036Z","avatar_url":"https://github.com/prodis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= LogMe\n\nA simple way to configure log in your gem.\n\nLogMe is especially useful when you need to log Web Service calls or HTTP requests and responses, using Net::HTTP or RestClient.\n\n{\u003cimg src=\"https://badge.fury.io/rb/log-me.png\" alt=\"Gem Version\" /\u003e}[http://badge.fury.io/rb/log-me]\n{\u003cimg src=\"https://travis-ci.org/prodis/log-me.png?branch=master\" alt=\"Build Status\" /\u003e}[https://travis-ci.org/prodis/log-me]\n{\u003cimg src=\"https://coveralls.io/repos/prodis/log-me/badge.png\" alt=\"Coverage Status\" /\u003e}[https://coveralls.io/r/prodis/log-me]\n{\u003cimg src=\"https://codeclimate.com/github/prodis/log-me.png\" alt=\"Code Climate\" /\u003e}[https://codeclimate.com/github/prodis/log-me]\n{\u003cimg src=\"https://gemnasium.com/prodis/log-me.png\" alt=\"Dependency Status\" /\u003e}[https://gemnasium.com/prodis/log-me]\n\n\n== Instalation\n\n=== Gemfile\n  gem 'log-me'\n\n=== Command line\n  $ gem install log-me\n\n== Usage\n\nIn your gem:\n  require 'log-me'\n\n  module CoolGem\n    extend LogMe\n  end\n\n  module CoolGem\n    class SomeClass\n      def do_something\n        # Do something and log\n        CoolGem.log \"I am logging something here.\"\n      end\n    end\n  end\n\nUsing your gem:\n  some = CoolGem::SomeClass.new\n  some.do_something\n\nBy default will be logged in STDOUT using log level :info:\n  I, [2011-08-24T01:22:52.677395 #3026]  INFO -- : [CoolGem] I am logging something here.\n\nLogging Net::HTTP requests and responses:\n  module CoolGem\n    class WebService\n      def do_something\n        url = \"http://prodis.blog.br\"\n\n        # Some logic to create a Net::HTTP request class.\n        request = create_request\n        CoolGem.log_request request, url\n\n        # Some logic to obtain a Net::HTTP response.\n        response = do_request(request, url)\n        CoolGem.log_response response\n\n        response\n      end\n    end\n  end\n\n  ws = CoolGem::WebService.new\n  ws.do_something\n\nLogging RestClient requests and responses:\n  module CoolGem\n    class WebService\n      def do_something\n        args = {\n          method: :post,\n          url: \"http://prodis.blog.br\",\n          payload: 'param1=value1\u0026param2=value2'\n        }\n\n        RestClient::Request.execute(args) do |response, request, result|\n          CoolGem.log_request request, args[:url]\n          CoolGem.log_response result\n          response\n        end\n      end\n    end\n  end\n\n  ws = CoolGem::WebService.new\n  ws.do_something\n\nIn the log:\n  [CoolGem] Request:\n  POST http://prodis.blog.br/some_resource\n  param1=value1\u0026param2=value2\n\n  [CoolGem] Response:\n  HTTP/1.1 201 Created\n\nYour gem consumer can configure the logger:\n  CoolGem.configure do |config|\n    config.log_enabled = false     # Disable log\n    config.log_level = :debug      # Change the log level\n    config.log_label = \"CoolLabel\" # Change label to log messages\n    config.logger = Rails.logger   # Use the Rails logger\n  end\n\n\n== Author\n- {Fernando Hamasaki de Amorim (prodis)}[http://prodis.blog.br]\n\n\n== Contributing to log-me\n\n* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.\n* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are happy with your contribution.\n* Don't forget to rebase with branch master in main project before submit the pull request.\n* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.\n\n\n== Copyright\n\n(The MIT License)\n\n{Prodis a.k.a. Fernando Hamasaki de Amorim}[http://prodis.blog.br]\n\nhttp://prodis.net.br/images/prodis_150.gif\n\nCopyright (c) 2011-2015 Prodis\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodis%2Flog-me","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprodis%2Flog-me","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodis%2Flog-me/lists"}