{"id":13578192,"url":"https://github.com/pieceofsummer/Hangfire.Console","last_synced_at":"2025-04-05T16:32:00.044Z","repository":{"id":37768343,"uuid":"71837779","full_name":"pieceofsummer/Hangfire.Console","owner":"pieceofsummer","description":"Job console extension for Hangfire","archived":false,"fork":false,"pushed_at":"2024-02-02T12:15:45.000Z","size":271,"stargazers_count":436,"open_issues_count":69,"forks_count":80,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-05T15:49:29.356Z","etag":null,"topics":["dashboard","extension","hangfire","logging"],"latest_commit_sha":null,"homepage":"","language":"C#","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/pieceofsummer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2016-10-24T22:35:28.000Z","updated_at":"2024-10-30T13:07:10.000Z","dependencies_parsed_at":"2024-11-05T15:39:07.822Z","dependency_job_id":"e767e220-598e-469a-a75d-a8acf54116a4","html_url":"https://github.com/pieceofsummer/Hangfire.Console","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pieceofsummer%2FHangfire.Console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pieceofsummer%2FHangfire.Console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pieceofsummer%2FHangfire.Console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pieceofsummer%2FHangfire.Console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pieceofsummer","download_url":"https://codeload.github.com/pieceofsummer/Hangfire.Console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366410,"owners_count":20927502,"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":["dashboard","extension","hangfire","logging"],"created_at":"2024-08-01T15:01:28.296Z","updated_at":"2025-04-05T16:31:59.698Z","avatar_url":"https://github.com/pieceofsummer.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"# Hangfire.Console\n\n[![Build status](https://ci.appveyor.com/api/projects/status/b57hb7438d7dvxa2/branch/master?svg=true\u0026passingText=master%20%u2714)](https://ci.appveyor.com/project/pieceofsummer/hangfire-console/branch/master)\n[![NuGet](https://img.shields.io/nuget/v/Hangfire.Console.svg)](https://www.nuget.org/packages/Hangfire.Console/)\n![MIT License](https://img.shields.io/badge/license-MIT-orange.svg)\n\nInspired by AppVeyor, Hangfire.Console provides a console-like logging experience for your jobs. \n\n![dashboard](dashboard.png)\n\n## Features\n\n - **Provider-agnostic**: (allegedly) works with any job storage provider (currently tested with SqlServer and MongoDB). \n - **100% Safe**: no Hangfire-managed data (e.g. jobs, states) is ever updated, hence there's no risk to corrupt it.\n - **With Live Updates**: new messages will appear as they're logged, as if you're looking at real console.\n - (blah-blah-blah)\n\n## Setup\n\nIn .NET Core's Startup.cs:\n```c#\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddHangfire(config =\u003e\n    {\n        config.UseSqlServerStorage(\"connectionSting\");\n        config.UseConsole();\n    });\n}\n```\n\nOtherwise,\n```c#\nGlobalConfiguration.Configuration\n    .UseSqlServerStorage(\"connectionSting\")\n    .UseConsole();\n```\n\n**NOTE**: If you have Dashboard and Server running separately, \nyou'll need to call `UseConsole()` on both.\n\n### Additional options\n\nAs usual, you may provide additional options for `UseConsole()` method.\n\nHere's what you can configure:\n- **ExpireIn** – time to keep console sessions (default: 24 hours)\n- **FollowJobRetentionPolicy** – expire all console sessions along with parent job (default: true)\n- **PollInterval** – poll interval for live updates, ms (default: 1000)\n- **BackgroundColor** – console background color (default: #0d3163)\n- **TextColor** – console default text color (default: #ffffff)\n- **TimestampColor** – timestamp text color (default: #00aad7)\n\n**NOTE**: After you initially add Hangfire.Console (or change the options above) you may need to clear browser cache, as generated CSS/JS can be cached by browser.\n\n## Log\n\nHangfire.Console provides extension methods on `PerformContext` object, \nhence you'll need to add it as a job argument. \n\n**NOTE**: Like `IJobCancellationToken`, `PerformContext` is a special argument type which Hangfire will substitute automatically. You should pass `null` when enqueuing a job.\n\nNow you can write to console:\n\n```c#\npublic void TaskMethod(PerformContext context)\n{\n    context.WriteLine(\"Hello, world!\");\n}\n```\n\nLike with `System.Console`, you can specify text color for your messages:\n\n```c#\npublic void TaskMethod(PerformContext context)\n{\n    context.SetTextColor(ConsoleTextColor.Red);\n    context.WriteLine(\"Error!\");\n    context.ResetTextColor();\n}\n```\n\n## Progress bars\n\nVersion 1.1.0 adds support for inline progress bars:\n\n![progress](progress.png)\n\n```c#\npublic void TaskMethod(PerformContext context)\n{\n    // create progress bar\n    var progress = context.WriteProgressBar();\n    \n    // update value for previously created progress bar\n    progress.SetValue(100);\n}\n```\n\nYou can create multiple progress bars and update them separately.\n\nBy default, progress bar is initialized with value `0`. You can specify initial value and progress bar color as optional arguments for `WriteProgressBar()`.\n\n### Enumeration progress\n\nTo easily track progress of enumeration over a collection in a for-each loop, library adds an extension method `WithProgress`:\n\n```c#\npublic void TaskMethod(PerformContext context)\n{\n    var bar = context.WriteProgressBar();\n    \n    foreach (var item in collection.WithProgress(bar))\n    {\n        // do work\n    }\n}\n```\n\nIt will automatically update progress bar during enumeration, and will set progress to 100% if for-each loop was interrupted with a `break` instruction.\n\n**NOTE**: If the number of items in the collection cannot be determined automatically (e.g. collection doesn't implement `ICollection`/`ICollection\u003cT\u003e`/`IReadOnlyCollection\u003cT\u003e`, you'll need to pass additional argument `count` to the extension method).\n\n## License\n\nCopyright (c) 2016 Alexey Skalozub\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpieceofsummer%2FHangfire.Console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpieceofsummer%2FHangfire.Console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpieceofsummer%2FHangfire.Console/lists"}