{"id":31932752,"url":"https://github.com/taig/flog","last_synced_at":"2025-10-14T05:24:16.877Z","repository":{"id":39827201,"uuid":"207911477","full_name":"taig/flog","owner":"taig","description":"Functional logging with metadata","archived":false,"fork":false,"pushed_at":"2025-10-06T08:56:55.000Z","size":1019,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-06T10:38:27.267Z","etag":null,"topics":["cats-effect","logging","scala","scalajs","structured-logging"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/taig.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-09-11T21:39:03.000Z","updated_at":"2025-10-06T08:56:59.000Z","dependencies_parsed_at":"2023-09-27T16:48:49.651Z","dependency_job_id":"14d431ca-a309-41f5-8beb-df51fb7f87ea","html_url":"https://github.com/taig/flog","commit_stats":{"total_commits":752,"total_committers":2,"mean_commits":376.0,"dds":"0.39893617021276595","last_synced_commit":"c3ff450c4600e5208be8ec0c96328ffd8e7fcf41"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"purl":"pkg:github/taig/flog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taig%2Fflog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taig%2Fflog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taig%2Fflog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taig%2Fflog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taig","download_url":"https://codeload.github.com/taig/flog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taig%2Fflog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018022,"owners_count":26086237,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cats-effect","logging","scala","scalajs","structured-logging"],"created_at":"2025-10-14T05:24:15.627Z","updated_at":"2025-10-14T05:24:16.862Z","avatar_url":"https://github.com/taig.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flog\n\n\u003e Functional logging with metadata\n\n[![GitLab CI](https://gitlab.com/taig-github/flog/badges/master/pipeline.svg?style=flat-square)](https://gitlab.com/taig-github/flog/pipelines)\n[![Maven Central](https://img.shields.io/maven-central/v/io.taig/flog-core_2.13.svg?style=flat-square)](https://search.maven.org/search?q=g:io.taig%20AND%20a:flog-*)\n[![License](https://img.shields.io/github/license/taig/flog?style=flat-square)](LICENSE)\n\n```scala\nlibraryDependencies ++=\n  \"io.taig\" %% \"flog-core\" % \"x.x.x\" ::\n  \"io.taig\" %% \"flog-slf4j\" % \"x.x.x\" ::\n  Nil\n```\n\n## Usage\n\n```scala\nimport cats.effect.*\nimport cats.effect.std.Dispatcher\nimport io.taig.flog.data.Level\nimport io.taig.flog.http4s.{CorrelationMiddleware, LoggingMiddleware}\nimport io.taig.flog.slf4j.FlogSlf4jBinder\nimport org.http4s.ember.server.EmberServerBuilder\nimport org.http4s.server.Server\nimport org.http4s.{HttpApp, HttpRoutes, Response}\nimport org.http4s.dsl.io.*\nimport com.comcast.ip4s.*\n\nobject SampleApp extends ResourceApp.Forever:\n  def app(logger: Logger[IO]): HttpApp[IO] = HttpRoutes.of[IO] {\n    case GET -\u003e Root / \"crash\" =\u003e IO.raiseError(new RuntimeException(\"💣\"))\n    case GET -\u003e Root =\u003e\n      logger.info(\"I'm handling a request here, and a trace information is automagically attached to my payload!\") *\u003e\n      Ok()\n    }.orNotFound\n\n  def server(logger: ContextualLogger[IO]): Resource[IO, Server] = EmberServerBuilder\n    .default[IO]\n    .withHost(host\"0.0.0.0\")\n    .withPort(port\"8080\")\n    .withHttpApp(CorrelationMiddleware(logger)(LoggingMiddleware(logger)(app(logger))))\n    .build\n\n  val logger: Resource[IO, Logger[IO]] = Dispatcher\n    .parallel[IO]\n    .flatMap: dispatcher =\u003e\n    Resource\n    .eval(Logger.stdOut[IO])\n    .flatMap(Logger.queued[IO])\n    .map(_.minimum(Level.Info))\n    .evalTap(FlogSlf4jBinder.initialize(_, dispatcher))\n\n  override def run(arguments: List[String]): Resource[IO, Unit] = for\n    logger \u003c- logger\n    contextual \u003c- Resource.eval(ContextualLogger.ofIO(logger))\n    _ \u003c- server(contextual)\n  yield ()\n\n```\n\n``` \n[2023-06-17 10:08:50.582][info][server] Request\n{\n  \"request\" : {\n    \"method\" : \"GET\",\n    \"uri\" : \"/\",\n    \"headers\" : {\n      \"Host\" : \"localhost:8080\",\n      \"User-Agent\" : \"curl/7.88.1\",\n      \"Accept\" : \"*/*\"\n    }\n  },\n  \"correlation\" : \"351f211a-c857-4b98-a1dd-b16240fa7fa1\"\n}\n[2023-06-17 10:08:50.597][info][/] I'm handling a request here, and a trace information is automagically attached to my payload!\n{\n  \"correlation\" : \"351f211a-c857-4b98-a1dd-b16240fa7fa1\"\n}\n[2023-06-17 10:08:50.598][info][server] Response\n{\n  \"response\" : {\n    \"status\" : \"200 OK\",\n    \"headers\" : {\n      \"Content-Length\" : \"0\"\n    }\n  },\n  \"correlation\" : \"351f211a-c857-4b98-a1dd-b16240fa7fa1\"\n}\n[2023-06-17 10:08:54.808][info][server] Request\n{\n  \"request\" : {\n    \"method\" : \"GET\",\n    \"uri\" : \"/crash\",\n    \"headers\" : {\n      \"Host\" : \"localhost:8080\",\n      \"User-Agent\" : \"curl/7.88.1\",\n      \"Accept\" : \"*/*\"\n    }\n  },\n  \"correlation\" : \"47b1dca1-50be-4c53-a621-ad16d72b1b35\"\n}\n[2023-06-17 10:08:54.813][error][server] Request failed\n{\n  \"correlation\" : \"47b1dca1-50be-4c53-a621-ad16d72b1b35\"\n}\njava.lang.RuntimeException: 💣\n\tat io.taig.flog.SampleApp$$anon$1.applyOrElse(SampleApp.scala:16)\n\t[...]\n```\n\n## Slf4j\n\n_Flog_ comes with its own slf4j backend in the `flog-slf4j` module. In order to enable it call `FlogSlf4jBinder.initialize` as early in your application initialization as possible.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaig%2Fflog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaig%2Fflog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaig%2Fflog/lists"}