All Projects → pieceofsummer → Hangfire.console

pieceofsummer / Hangfire.console

Licence: mit
Job console extension for Hangfire

Projects that are alternatives of or similar to Hangfire.console

Anychart
AnyChart is a lightweight and robust JavaScript charting solution with great API and documentation. The chart types and unique features are numerous, the library works easily with any development stack.
Stars: ✭ 288 (-6.8%)
Mutual labels:  dashboard
Console
OS X console application.
Stars: ✭ 298 (-3.56%)
Mutual labels:  logging
Daiquiri
Python library to easily setup basic logging functionality
Stars: ✭ 308 (-0.32%)
Mutual labels:  logging
Django Jet
Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo
Stars: ✭ 3,207 (+937.86%)
Mutual labels:  dashboard
Metatron Discovery
Powerful & Easy way for big data discovery
Stars: ✭ 297 (-3.88%)
Mutual labels:  dashboard
Laravel Starter
A CMS like modular starter application project built with Laravel 8.x.
Stars: ✭ 299 (-3.24%)
Mutual labels:  dashboard
Syncano Dashboard
The Syncano Dashboard built with React.
Stars: ✭ 287 (-7.12%)
Mutual labels:  dashboard
Coreui Free React Admin Template
CoreUI React is a free React admin template based on Bootstrap 5
Stars: ✭ 3,573 (+1056.31%)
Mutual labels:  dashboard
Borgert Cms
Borgert is a CMS Open Source created with Laravel Framework 5.6
Stars: ✭ 298 (-3.56%)
Mutual labels:  logging
Dashboard Nvim
vim dashboard
Stars: ✭ 294 (-4.85%)
Mutual labels:  dashboard
Windmill Dashboard React
❄ A multi theme, completely accessible, ready for production dashboard.
Stars: ✭ 283 (-8.41%)
Mutual labels:  dashboard
Covid19
an interactive, animated COVID-19 coronavirus map to track the outbreak over time by country and by region for selected countries
Stars: ✭ 295 (-4.53%)
Mutual labels:  dashboard
Scribe
The fastest logging library in the world. Built from scratch in Scala and programmatically configurable.
Stars: ✭ 304 (-1.62%)
Mutual labels:  logging
Balena Dash
Build a Raspberry Pi based desktop dashboard for stats, photos, videos and more!
Stars: ✭ 292 (-5.5%)
Mutual labels:  dashboard
Carbon
Elegant Bootstrap 4 Admin Template
Stars: ✭ 309 (+0%)
Mutual labels:  dashboard
Vortex
🌀 Discord Moderation Bot
Stars: ✭ 283 (-8.41%)
Mutual labels:  logging
Light Bootstrap Dashboard Angular2
Light Bootstrap Dashboard Angular 2
Stars: ✭ 299 (-3.24%)
Mutual labels:  dashboard
Nepadmin
nepadmin 单页面后台模版,基于 layui 2.4.0
Stars: ✭ 309 (+0%)
Mutual labels:  dashboard
Flask jsondash
🐍 📊 📈 Build complex dashboards without any front-end code. Use your own endpoints. JSON config only. Ready to go.
Stars: ✭ 3,215 (+940.45%)
Mutual labels:  dashboard
Shinydashboardplus
extensions for shinydashboard
Stars: ✭ 304 (-1.62%)
Mutual labels:  dashboard

Hangfire.Console

Build status NuGet MIT License

Inspired by AppVeyor, Hangfire.Console provides a console-like logging experience for your jobs.

dashboard

Features

  • Provider-agnostic: (allegedly) works with any job storage provider (currently tested with SqlServer and MongoDB).
  • 100% Safe: no Hangfire-managed data (e.g. jobs, states) is ever updated, hence there's no risk to corrupt it.
  • With Live Updates: new messages will appear as they're logged, as if you're looking at real console.
  • (blah-blah-blah)

Setup

In .NET Core's Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
    services.AddHangfire(config =>
    {
        config.UseSqlServerStorage("connectionSting");
        config.UseConsole();
    });
}

Otherwise,

GlobalConfiguration.Configuration
    .UseSqlServerStorage("connectionSting")
    .UseConsole();

NOTE: If you have Dashboard and Server running separately, you'll need to call UseConsole() on both.

Additional options

As usual, you may provide additional options for UseConsole() method.

Here's what you can configure:

  • ExpireIn – time to keep console sessions (default: 24 hours)
  • FollowJobRetentionPolicy – expire all console sessions along with parent job (default: true)
  • PollInterval – poll interval for live updates, ms (default: 1000)
  • BackgroundColor – console background color (default: #0d3163)
  • TextColor – console default text color (default: #ffffff)
  • TimestampColor – timestamp text color (default: #00aad7)

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.

Log

Hangfire.Console provides extension methods on PerformContext object, hence you'll need to add it as a job argument.

NOTE: Like IJobCancellationToken, PerformContext is a special argument type which Hangfire will substitute automatically. You should pass null when enqueuing a job.

Now you can write to console:

public void TaskMethod(PerformContext context)
{
    context.WriteLine("Hello, world!");
}

Like with System.Console, you can specify text color for your messages:

public void TaskMethod(PerformContext context)
{
    context.SetTextColor(ConsoleTextColor.Red);
    context.WriteLine("Error!");
    context.ResetTextColor();
}

Progress bars

Version 1.1.0 adds support for inline progress bars:

progress

public void TaskMethod(PerformContext context)
{
    // create progress bar
    var progress = context.WriteProgressBar();
    
    // update value for previously created progress bar
    progress.SetValue(100);
}

You can create multiple progress bars and update them separately.

By default, progress bar is initialized with value 0. You can specify initial value and progress bar color as optional arguments for WriteProgressBar().

Enumeration progress

To easily track progress of enumeration over a collection in a for-each loop, library adds an extension method WithProgress:

public void TaskMethod(PerformContext context)
{
    var bar = context.WriteProgressBar();
    
    foreach (var item in collection.WithProgress(bar))
    {
        // do work
    }
}

It will automatically update progress bar during enumeration, and will set progress to 100% if for-each loop was interrupted with a break instruction.

NOTE: If the number of items in the collection cannot be determined automatically (e.g. collection doesn't implement ICollection/ICollection<T>/IReadOnlyCollection<T>, you'll need to pass additional argument count to the extension method).

License

Copyright (c) 2016 Alexey Skalozub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].