{"id":15649666,"url":"https://github.com/nblumhardt/serilog-sinks-browserhttp","last_synced_at":"2025-04-09T09:10:39.718Z","repository":{"id":36088330,"uuid":"151718449","full_name":"nblumhardt/serilog-sinks-browserhttp","owner":"nblumhardt","description":"Serilog sink for client-side Blazor, with matching ASP.NET Core server relay","archived":false,"fork":false,"pushed_at":"2025-01-16T05:54:53.000Z","size":324,"stargazers_count":53,"open_issues_count":12,"forks_count":23,"subscribers_count":10,"default_branch":"dev","last_synced_at":"2025-04-02T08:07:24.802Z","etag":null,"topics":["blazor","logging","serilog"],"latest_commit_sha":null,"homepage":"https://serilog.net","language":"C#","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/nblumhardt.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-05T12:37:20.000Z","updated_at":"2025-01-16T05:54:54.000Z","dependencies_parsed_at":"2025-02-25T08:00:40.648Z","dependency_job_id":"04e17d50-b26c-4b90-852f-433f9fd2710c","html_url":"https://github.com/nblumhardt/serilog-sinks-browserhttp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nblumhardt%2Fserilog-sinks-browserhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nblumhardt%2Fserilog-sinks-browserhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nblumhardt%2Fserilog-sinks-browserhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nblumhardt%2Fserilog-sinks-browserhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nblumhardt","download_url":"https://codeload.github.com/nblumhardt/serilog-sinks-browserhttp/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"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":["blazor","logging","serilog"],"created_at":"2024-10-03T12:30:46.948Z","updated_at":"2025-04-09T09:10:39.687Z","avatar_url":"https://github.com/nblumhardt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serilog.Sinks.BrowserHttp [![Build status](https://ci.appveyor.com/api/projects/status/3cdhiwgd59sfdpg5?svg=true)](https://ci.appveyor.com/project/NicholasBlumhardt/serilog-sinks-browserhttp)\n\n\u003e [!IMPORTANT]\n\u003e This project is a proof-of-concept and is not being actively maintained.\n\nA Serilog sink for client-side Blazor that posts batched events using the browser's HTTP stack. These can be sent to any remote HTTP endpoint, including the app's origin server. A companion package, _Serilog.AspNetCore.Ingestion_, is also published from this repository, and can be used to relay events from the client to Serilog running in the ASP.NET Core server process.\n\n### Getting started\n\nIn a Blazor client (WASM) app, first install _Serilog.Sinks.BrowserHttp_:\n\n```\ndotnet add package Serilog.Sinks.BrowserHttp\n```\n\nThe sink is enabled using `WriteTo.BrowserHttp`:\n\n```csharp\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\nLog.Logger = new LoggerConfiguration()\n    .MinimumLevel.ControlledBy(levelSwitch)\n    .WriteTo.BrowserConsole()\n    .WriteTo.BrowserHttp($\"{builder.HostEnvironment.BaseAddress}ingest\")\n    .CreateLogger();\n\nLog.Information(\"Hello, browser!\");\n```\n\nEvents will be `POST`ed in newline-delimited JSON batches to the given URL. See\n [_Serilog.Formatting.Compact_](https://github.com/serilog/serilog-formatting-compact) for a description of the JSON\nschema that is used.\n\n### Server-side relay for ASP.NET Core\n\nTo use the server-side relay in an ASP.NET Core app that uses Serilog, install _Serilog.AspNetCore.Ingestion_:\n\n```\ndotnet add package Serilog.AspNetCore.Ingestion\n```\n\nThen, add `UseSerilogIngestion()` to the app builder in _Startup.cs_:\n\n```csharp\napp.UseSerilogIngestion();\n```\n\nThe client app should be configured with `LoggingLevelSwitch` so that the server can control the client's logging level. An endpoint address is not required. For example:\n\n```csharp\n// In a Blazor WASM Program.cs file\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\nvar levelSwitch = new LoggingLevelSwitch();\nLog.Logger = new LoggerConfiguration()\n    .MinimumLevel.ControlledBy(levelSwitch)\n    .WriteTo.BrowserHttp($\"{builder.HostEnvironment.BaseAddress}ingest\", controlLevelSwitch: levelSwitch)\n    .CreateLogger();\n\nLog.Information(\"Hello, browser!\");\n```\n\nSee the `/samples` directory in this repository for a working end-to-end example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnblumhardt%2Fserilog-sinks-browserhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnblumhardt%2Fserilog-sinks-browserhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnblumhardt%2Fserilog-sinks-browserhttp/lists"}