{"id":21944702,"url":"https://github.com/browserstack/chitragupta-rails","last_synced_at":"2026-02-05T14:04:59.859Z","repository":{"id":42666395,"uuid":"341166096","full_name":"browserstack/chitragupta-rails","owner":"browserstack","description":"Rails SDK for structured JSON logging","archived":false,"fork":false,"pushed_at":"2025-06-20T10:43:53.000Z","size":43,"stargazers_count":1,"open_issues_count":3,"forks_count":2,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-07-01T06:51:35.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/browserstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-22T10:44:43.000Z","updated_at":"2025-06-20T09:21:27.000Z","dependencies_parsed_at":"2023-11-14T08:37:26.748Z","dependency_job_id":"69e5149a-e35d-458b-b07a-6d716ed9c2f8","html_url":"https://github.com/browserstack/chitragupta-rails","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/browserstack/chitragupta-rails","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fchitragupta-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fchitragupta-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fchitragupta-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fchitragupta-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserstack","download_url":"https://codeload.github.com/browserstack/chitragupta-rails/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fchitragupta-rails/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264432505,"owners_count":23607441,"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-29T04:16:56.616Z","updated_at":"2026-02-05T14:04:54.821Z","avatar_url":"https://github.com/browserstack.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chitragupta\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'chitragupta', git: \"git://github.com/browserstack/chitragupta-rails.git\"\n```\n\n## Usage\n\n### Configuring\nAdd the following line in either `application.rb` or `\u003cenvironment\u003e.rb`\n\n```ruby\nrequire \"chitragupta\"\n\nChitragupta::setup_application_logger(RailsApplicationModule, :current_user_function)\n```\nThe `RailsApplicationModule` should be replaced with the rails application module.\nThe `:current_user_function` should be replaced with a symbol of the callable which when called returns the current user object.\n\n### Ruby Server Application\nSample code block:\n```ruby\nrequire \"chitragupta\"\n\ncg_logger = Logger.new('/tmp/already_existing_logfile.log')\ncg_logger.formatter = Chitragupta::JsonLogFormatter.new\n\n# for sinatra application\nChitragupta.payload = {\n  'method': request.request_method,\n  'path': request.path_info,\n  'ip': request.ip,\n  'request_id': 1234, # Request ID goes here\n  'user_id': 1, # Requesting user ID goes here\n  'params': request.params\n}\ncg_logger.info({\"status\": 200, # status code of server request\n                \"duration\": 100,\n                \"log\": { \"id\": 12345,\n                         \"kind\": \"dc_log_migration\", # Log kind to be added here\n                         \"dynamic_data\": \"Starting remote call for URL\"}\n               })\n\n```\n\n### Additional Logging\nYou can use `Rails.logger`\nOR\nYou can create logger object as follows\n```\nlogger = Chitragupta::Logger.new(STDOUT)\n```\n\nIn case you have custom logger objects created, you can change the formatter(as below) to ensure the logs are structured.\n```\nlogger = Logger.new(STDOUT)\nlogger.formatter = Chitragupta::JsonLogFormatter.new\n```\n\nPassing values for `log.*` or `meta.*`\n```\nRails.logger.info({ log: { id: 'some-unique-id', kind: 'UNIQUE_KIND' }})\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/browserstack/chitragupta-rails.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserstack%2Fchitragupta-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserstack%2Fchitragupta-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserstack%2Fchitragupta-rails/lists"}