{"id":36577274,"url":"https://github.com/tychoish/grip","last_synced_at":"2026-01-12T07:37:23.132Z","repository":{"id":40990856,"uuid":"340553093","full_name":"tychoish/grip","owner":"tychoish","description":"Pluggable logging and messaging library for go. ","archived":false,"fork":false,"pushed_at":"2025-10-29T02:54:51.000Z","size":1350,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T04:27:20.856Z","etag":null,"topics":["logging"],"latest_commit_sha":null,"homepage":"","language":"Go","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/tychoish.png","metadata":{"files":{"readme":"README.rst","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-20T03:34:32.000Z","updated_at":"2025-10-29T02:54:54.000Z","dependencies_parsed_at":"2023-01-31T12:15:17.942Z","dependency_job_id":"eace8090-e14e-46b2-adb9-d768f3200498","html_url":"https://github.com/tychoish/grip","commit_stats":{"total_commits":588,"total_committers":15,"mean_commits":39.2,"dds":0.3843537414965986,"last_synced_commit":"6952277f9607cd4bd90b7afe5f4824231902d83b"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/tychoish/grip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Fgrip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Fgrip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Fgrip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Fgrip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tychoish","download_url":"https://codeload.github.com/tychoish/grip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tychoish%2Fgrip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28336600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["logging"],"created_at":"2026-01-12T07:37:20.498Z","updated_at":"2026-01-12T07:37:23.123Z","avatar_url":"https://github.com/tychoish.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"====================================\n``grip`` -- A Golang Logging Library\n====================================\nq\nOverview\n--------\n\nGrip is a high level logging and message system for providing a single\nsolution for structured logging, notification, and message sending.\n\n#. Provide a common logging interface with support for multiple\n   output/messaging backends.\n\n#. Provides tools for collecting structured logging information.\n\n*You just get a grip, folks.*\n\nUse\n---\n\n``grip`` declares its dependencies via go modules. The top level ``grip``\npackage provides global logging functions that use a global logging\ninterface. You can also use the logging package to produce logger objects with\nthe same interface to avoid relying on a global logger.\n\nGrip is available under the terms of the Apache License (v2.)\n\nDesign\n------\n\nInterface\n~~~~~~~~~\n\nGrip provides two main interfaces:\n\n- The ``send.Sender`` interfaces which implements sending messages to various\n  output sources. Provides sending as well as the ability to support error\n  handling, and message formating support.\n\n- The ``message.Composer`` which wraps messages providing both \"string\"\n  formating as well as a \"raw data\" approach for structured data. With the\n  ``message.Base`` implementation, it becomes possible to implement\n  ``Composer`` for arbitrary payloads within your application, which may be\n  useful for metrics payloads.\n\nAdditionally, there are a couple of types for convenience: the ``grip.Logger``\ntype provides a basic leveled application logging that uses ``Sender``\nimplementations, and ``message.Builder`` provides a chainable interface for\nbuilding log messages.\n\nGoals\n~~~~~\n\n- Provide exceptional high-level interfaces for logging and metrics\n  collection, with great ergonomics that simplify applications and\n  operational stories.\n\n- Integrate with other logging systems (e.g. standard library logging,\n  standard output of subprocesses, other libraries, etc.) to accommodate most\n  usecases.\n\n- Minimize operational complexity and dependencies for having robust logging\n  (e.g. make it possible to log effectively from within a program without\n  requiring log relays or collection agents.)\n\nPerformance is not explicitly a goal, although reasonable performace should be\npossible and architectures should always be possible that prevent the logger\nfrom becoming a performance bottleneck in applications.\n\nFeatures\n--------\n\nGlobal Logger\n~~~~~~~~~~~~~\n\nFollowing the standard library, and other logging packages, the top-level grip\npackage has a \"global\" logger, that you can use without any configuration, and\nthat wraps the standard library's global logging instance. The global\nfunctions in this package have the same signatures and types as the methods of\nthe ``Logger`` type. The ``SetGlobalLogger`` allows you to override the global\nlogger: note, however, that this function (and the functions,) are not\nthread-safe when used relative to each other, so *only* use\n``SetGlobalLogger`` during process configuration and minimize the amount of\nlogger re-configuration your application does.\n\nFor many applications, using and passing a copy of the ``Logger`` you want to\nuse is preferable.\n\n``Logger``\n~~~~~~~~~~\n\n``Logger`` instances simply wrap ``Sender`` instances and most of the\nconfiguration (e.g. levels and threshold) are actually properties of the\nmessages and the sender. If you want to create a new logger that is a \"child\"\nof an existing logger, consider something like: ::\n\n    // new logger instance wrapping the sender instance from the global logger\n    // this is just for the sake of example:\n    logger := grip.NewLogger(grip.Sender())\n\n    // create new logger that annotates all messages\n    subLogger := grip.NewLogger(send.MakeAnnotating(\n\tlogger.Sender(),\n\tmap[string]any{\n\t\t\"module\": \"http\",\n\t\t\"pid\":    os.Getpid(),\n\t}))\n\n\nSimilarly, you could create an annotating logger that sent to two output\ntargets: ::\n\n    multiLogger := grip.NewLogger(send.MakeMulti(\n\tgrip.Sender(),\n\tsend.NewAnnotating(\n\t    logger.Sender(),\n\t    map[string]any{\n\t\t    \"module\": \"http\",\n\t\t    \"pid\":    os.Getpid(),\n\t    })\n    ))\n\nWhile this specific example may not be useful (send all messages to the\nstandard logger output, and also send message to the annotating sender,) but\nthis kind of configuration can be useful if you want to filter messages of\ndifferent types to different outputs, or write messages to a local output\n(e.g. standard output, standard error, system journal, etc.) as well as a\nremote service (e.g. splunk, sumo logic, etc.).\n\nThe ``x`` Packages\n~~~~~~~~~~~~~~~~~~\n\nIn an effort to reduce the impact for downstream users of additional\ndependencies, the ``x`` package includes code that relies on third party\nlibraries to provide metrics collecting functionality as well as novel\nmechanisms for sending messages. It's possible to use senders and loggers, to\npropogate messages over email and sump, as well as using grip as an interface\nto send logs directly to external aggregation services, such as splunk.\n\nFeatures implemented here include:\n\n- sending sumologic/splunk messages directly.\n- sending messages directly to syslog and/or the systemd journal.\n- desktop notifications\n- slack messages\n- creating jira tickets and commenting on jira issues\n- creating github issues and updating github statuses\n- sending email messages\n- message payloads the capture system metrics:\n  - go runtime metrics\n  - process-tree metrics\n  - single process metrics.\n\nWhile the core of grip only has dependency on a single library, `fun\n\u003cgithub.com/tychoish/fun\u003e`_, the packages in the ``x`` hierarchy do have\nexternal dependencies. However, the project and go mod files are structured so\nthat these libraries are managed by different go mod files and can be\nversioned separately.\n\n``send.Sender``\n~~~~~~~~~~~~~~~\n\nSenders all wrap some sort of output target, which is at some level an\n``io.Writer`` or similar kind of interface. The ``send`` package contains a\nnumber of different configurations (standard error, standard output, files,\netc.) as well as 1additional tools for managing output targets, notably:\n\n- converters for ``Sender`` implementations to ``io.Writer``\n  instances.\n\n- connections with standard library logging tools.\n\n- buffering and asynchronous senders to reduce backpressure from loggers and\n  to batch workloads to (potentially) slower senders.\n\n- multi sender tools, to manage a group of related outputs.\n\nSenders also permit configurable formating hooks and error handling hooks.\n\n``message.Composer``\n~~~~~~~~~~~~~~~~~~~~\n\nThe ``Composer`` interface is used for all messages, and provides a flexible\n(and simple!) interface to create arbitrary messages, which can be\nparticularly useful for producing structured logging messages from your\napplication types. Fundamentally, most ``Composer`` implementations should be lazy,\nand require minimal runtime resources in the case that the messages aren't\nloggable, either as a result of their content (missing or not rising to the\nthreshold of loggability,) or because of the priority thresholds on the\nlogger/sender itself.\n\nThe message package provides a collection of implementations and features,\nincluding:\n\n- a ``Base`` type which you can compose in your own ``Composer``\n  implementations which provides most of the implementation interface and\n  holds some basic message metadata (level, timestamp, pid, hostname.) As a\n  result implementors only need to implement ``Loggable``, ``String`` and\n  ``Raw`` methods.\n\n- a ``GroupMessage`` that provides a bundle of messages, which sender\n  implementations can use to batch output. Additionally, the ``Wrap`` and\n  ``Unwrap`` methods provide a stack-based approach to grouping messages.\n\n- the ``Builder`` type provides a chainable interface for creating and sending\n  log messages, which is integrated into the ``grip.Logger`` interface.\n\n- Conditional or ``When`` messages allow you to embed logging conditions in\n  the message, which can simplify the call site for logging messages.\n\n- Error wrappers that convert go error objects into log messages, which are\n  non-loggable when the error is nil, with an error-wrapping function that\n  makes it possible to annotate messages.\n\n- Logging functions, or producers, which are functions that produce messages,\n  or errors and are only called when the message loggable (e.g. for priority\n  level thresholds).\n\nDevelopment\n-----------\n\nFuture Work\n~~~~~~~~~~~\n\nGrip is relatively stable, though there are additional features and areas of\ndevelopment:\n\n- structured metrics collection. This involves adding a new interface as a\n  superset of the Composer interface, and providing ways of filtering these\n  messages out to provide better tools for collecting diagnostic data from\n  applications.\n\n- additional Sender implementations to support additional output formats and\n  needs.\n\n- better integration with recent development in error wrapping in the go\n  standard library.\n\n- Shims for other popular logging frameworks to facilitate migrations and\n  provide grip users to the benefits of existing infrastructure without\n  requiring large refactoring.\n\nIf you encounter a problem please feel free to create a github issue or open a\npull request.\n\nHistory\n~~~~~~~\n\nGrip originated as a personal project, and became the default logging and\nmessaging tool for `Evergreen \u003chttps://github.com/evergreen-ci/\u003e`_ and related\nprojects at MongoDB's release infrastructure developer productivity\norganization.\n\nThis fork removes some legacy components and drops support older versions of\nGolang, thereby adding support for modules. Additionally the ``x`` hierarchy\ncontains many external integrations that were previously in the main\npackage. These reorganizations should improve performance and dependency\nmanagement and make it easier to stablize releases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftychoish%2Fgrip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftychoish%2Fgrip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftychoish%2Fgrip/lists"}