{"id":26496126,"url":"https://github.com/damonbauer/logsnag-ruby","last_synced_at":"2025-07-22T15:36:26.787Z","repository":{"id":206208550,"uuid":"716078638","full_name":"damonbauer/logsnag-ruby","owner":"damonbauer","description":"Unofficial LogSnag API client, written in Ruby","archived":false,"fork":false,"pushed_at":"2024-06-02T19:36:27.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T19:17:12.099Z","etag":null,"topics":["logsnag","ruby","rubygem"],"latest_commit_sha":null,"homepage":"https://docs.logsnag.com/","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/damonbauer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-08T12:12:16.000Z","updated_at":"2024-06-02T19:36:30.000Z","dependencies_parsed_at":"2023-11-08T13:44:46.330Z","dependency_job_id":"d64b34c1-79d4-4898-bba7-82ea9f9b0539","html_url":"https://github.com/damonbauer/logsnag-ruby","commit_stats":null,"previous_names":["damonbauer/logsnag-ruby"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonbauer%2Flogsnag-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonbauer%2Flogsnag-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonbauer%2Flogsnag-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damonbauer%2Flogsnag-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damonbauer","download_url":"https://codeload.github.com/damonbauer/logsnag-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244603453,"owners_count":20479832,"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":["logsnag","ruby","rubygem"],"created_at":"2025-03-20T11:29:24.344Z","updated_at":"2025-03-20T11:29:28.750Z","avatar_url":"https://github.com/damonbauer.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/logsnag-ruby.svg)](https://badge.fury.io/rb/logsnag-ruby)\n\n# logsnag-ruby\n\nInteract with the [LogSnag](https://logsnag.com) API to send logs, identify users, and send insights.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'logsnag-ruby'\n```\n\nAnd then execute:\n\n```bash\nbundle install\n```\n\nOr install it yourself as:\n\n```bash\ngem install logsnag-ruby\n```\n\n## Configuration\n\nBefore you can send logs to LogSnag, you need to configure the gem with your API token and project name.\nThis is typically done in an initializer in your application.\nFor example:\n\n```ruby\n# config/initializers/logsnag.rb\n\nLogSnag.configure do |config|\n  config.api_token = \"your_api_token\"\n  config.project = \"your_project_name\"\nend\n```\n\n## Usage\n\nThe `logsnag-ruby` gem provides several methods to interact with the LogSnag API.\n\nEach method will automatically add the `project` and `api_token` parameters to the request.\n\n### Logging Events\n\nTo send an event log:\n\n```ruby\nLogSnag.log({\n  channel: \"server\",\n  event: \"server_start\",\n  # ... other optional parameters ...\n})\n```\n\n**Arguments:**\n\n- `data`: A hash containing the event data.\n    - **Required keys:**\n        - `channel` [String]: The channel within the project to which the log belongs.\n        - `event` [String]: The name of the event.\n    - Optional keys:\n        - `user_id` [String]: The user ID of the user related to the event.\n        - `description` [String]: The description of the event.\n        - `icon` [String]: The icon to be displayed with the event.\n        - `notify` [Boolean]: Whether to send a push notification for the event.\n        - `tags` [Hash]: The tags associated with the event. See [the LogSnag docs](https://docs.logsnag.com/api-reference/log#tags) for more information regarding the format of the `tags` hash.\n        - `parser` [String]: The parser to be used for the event. One of \"text\" or \"markdown\".\n        - `timestamp` [Numeric]: The timestamp of the event (in Unix seconds).\n\n**Returns:**\n\n- `LogSnag::Result`: A result object with the following methods:\n    - `success?`: Returns `true` if the request was successful.\n    - `error?`: Returns `true` if the request failed.\n    - `data`: The parsed response data from the server.\n    - `error_message`: The error message if the request failed.\n    - `status_code`: The HTTP status code of the response.\n\n### Identifying Users\n\nTo add or update properties to a user profile:\n\n```ruby\nLogSnag.identify({\n  user_id: \"user_123\",\n  properties: {\n    email: \"user@example.com\",\n    plan: \"premium\"\n  }\n})\n```\n\n**Arguments:**\n\n- `data`: A hash containing the identification data.\n    - **Required keys:**\n        - `user_id` [String]: The user ID of the user to be identified.\n        - `properties` [Hash]: The properties of the user to be identified. See [the LogSnag docs](https://docs.logsnag.com/api-reference/identify#properties-schema) for more information regarding the format of the `properties` hash.\n\n**Returns:**\n\n- `LogSnag::Result`: A result object with the following methods:\n    - `success?`: Returns `true` if the request was successful.\n    - `error?`: Returns `true` if the request failed.\n    - `data`: The parsed response data from the server.\n    - `error_message`: The error message if the request failed.\n    - `status_code`: The HTTP status code of the response.\n\n### Sending Insights\n\nTo send an insight log:\n\n```ruby\nLogSnag.insight({\n  title: \"New Signups\",\n  value: 42,\n  # ... other optional parameters ...\n})\n```\n\n**Arguments:**\n\n- `data`: A hash containing the insight data.\n    - **Required keys:**\n        - `title` [String]: The title of the insight.\n        - `value` [String, Numeric]: The numerical value of the insight.\n    - Optional keys:\n        - `icon` [String]: The icon to be displayed with the insight.\n\n**Returns:**\n\n- `LogSnag::Result`: A result object with the following methods:\n    - `success?`: Returns `true` if the request was successful.\n    - `error?`: Returns `true` if the request failed.\n    - `data`: The parsed response data from the server.\n    - `error_message`: The error message if the request failed.\n    - `status_code`: The HTTP status code of the response.\n\n### Mutating Insights\n\nTo mutate (increment) an existing numerical insight:\n\n```ruby\nLogSnag.mutate_insight({ \n  title: \"Total Users\", \n  value: 5\n})\n```\n\n**Arguments:**\n\n- `data`: A hash containing the insight mutation data.\n    - **Required keys:**\n        - `title` [String]: The title of the insight.\n        - `value` [Numeric]: The amount to increment the insight by.\n    - Optional keys:\n        - `icon` [String]: The icon to be displayed with the insight.\n\n**Returns:**\n\n- `LogSnag::Result`: A result object with the following methods:\n    - `success?`: Returns `true` if the request was successful.\n    - `error?`: Returns `true` if the request failed.\n    - `data`: The parsed response data from the server.\n    - `error_message`: The error message if the request failed.\n    - `status_code`: The HTTP status code of the response.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub\nat [https://github.com/damonbauer/logsnag-ruby](https://github.com/damonbauer/logsnag-ruby).\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%2Fdamonbauer%2Flogsnag-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamonbauer%2Flogsnag-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamonbauer%2Flogsnag-ruby/lists"}