{"id":19422538,"url":"https://github.com/scalalandio/log4effect","last_synced_at":"2026-05-17T14:37:20.176Z","repository":{"id":57736152,"uuid":"210783398","full_name":"scalalandio/log4effect","owner":"scalalandio","description":"Cats Effect syntax for logging","archived":false,"fork":false,"pushed_at":"2020-10-30T15:31:51.000Z","size":141,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T18:43:14.965Z","etag":null,"topics":["cats-effect","interpolation","logging"],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/scalalandio.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}},"created_at":"2019-09-25T07:32:27.000Z","updated_at":"2024-10-10T01:56:22.000Z","dependencies_parsed_at":"2022-08-23T22:40:34.007Z","dependency_job_id":null,"html_url":"https://github.com/scalalandio/log4effect","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalalandio%2Flog4effect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalalandio%2Flog4effect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalalandio%2Flog4effect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalalandio%2Flog4effect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scalalandio","download_url":"https://codeload.github.com/scalalandio/log4effect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240601495,"owners_count":19827357,"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":["cats-effect","interpolation","logging"],"created_at":"2024-11-10T13:34:06.435Z","updated_at":"2026-05-17T14:37:15.147Z","avatar_url":"https://github.com/scalalandio.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log4effect\n\n[![https://travis-ci.org/scalalandio/log4effect](https://api.travis-ci.org/scalalandio/log4effect.svg?branch=master)](https://travis-ci.org/scalalandio/log4effect)\n[![Maven Central](https://img.shields.io/maven-central/v/io.scalaland/log4effect_2.12.svg)](http://search.maven.org/#search%7Cga%7C1%7Clog4effect)\n[![License](http://img.shields.io/:license-Apache%202-green.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)\n\nIf you missed some syntax for logging with Cats Effect, then here it is.\n\n## Getting started\n\nLibrary is available for Scala 2.11, 2.12, 2.13.\n\nAdd it with:\n\n```scala\nlibraryDependencies += \"io.scalaland\" %% \"log4effect\" % log4EffectVersion\n```\n\n## Usage\n\nLogging is done using `Logged` type class:\n\n```scala\nimport cats.effect.Sync\nimport io.scalaland.log4effect.Logged\n\ndef operation[F[_]: Sync: Logged] = for {\n  a \u003c- Sync[F].defer(1 + 1)\n  b \u003c- Sync[F].defer(2 + 2)\n  _ \u003c- Logged[F].info(s\"a = $a b=$b\")\n} yield a -\u003e b\n```\n\nIf you want you can use interpolator syntax - it assumes that there is\n`cats.Show` instance for any value that you use in it.\n\n```scala\nimport cats.implicits._\nimport io.scalaland.log4effect.Logged\nimport io.scalaland.log4effect.syntax._\n\nval i = 1\nval d = 1.0\nval s = \"test\"\n\ndef logs[F[_]: Monad: Logged] = for {\n  _ \u003c- trace\"$i $d $s\"[F]\n  _ \u003c- trace\"$i $d $s\".withEx[F](new Exception(\"with ex\"))\n  _ \u003c- debug\"$i $d $s\"[F]\n  _ \u003c- debug\"$i $d $s\".withEx[F](new Exception(\"with ex\"))\n  _ \u003c- info\"$i $d $s\"[F]\n  _ \u003c- info\"$i $d $s\".withEx[F](new Exception(\"with ex\"))\n  _ \u003c- warn\"$i $d $s\"[F]\n  _ \u003c- warn\"$i $d $s\".withEx[F](new Exception(\"with ex\"))\n  _ \u003c- error\"$i $d $s\"[F]\n  _ \u003c- error\"$i $d $s\".withEx[F](new Exception(\"with ex\"))\n} yield ()\n```\n\nIf there is no `cats.Show` you'd have to call `.toString` explicitly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscalalandio%2Flog4effect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscalalandio%2Flog4effect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscalalandio%2Flog4effect/lists"}