Skip to content

Commit

Permalink
ns
Browse files Browse the repository at this point in the history
  • Loading branch information
vvproosdij authored and vvproosdij committed Oct 31, 2016
1 parent fe7351f commit 478088e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 80 deletions.
1 change: 0 additions & 1 deletion Hangfire.Dashboard.Dark.sln
Expand Up @@ -8,7 +8,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{657DF223-42EC-4765-990B-334C62F602EA}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
dashboard.png = dashboard.png
global.json = global.json
README.md = README.md
EndProjectSection
Expand Down
81 changes: 8 additions & 73 deletions README.md
@@ -1,18 +1,13 @@
# Hangfire.Console
# Hangfire.Dashboard.Dark

![Build status](https://ci.appveyor.com/api/projects/status/b57hb7438d7dvxa2/branch/master?svg=true&passingText=master%20%u2714)
[![NuGet](https://img.shields.io/nuget/v/Hangfire.Console.svg)](https://www.nuget.org/packages/Hangfire.Console/)
[![NuGet](https://img.shields.io/nuget/v/Hangfire.Dashboard.Dark.svg)](https://www.nuget.org/packages/Hangfire.Dashboard.Dark/)

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

![dashboard](dashboard.png)
Inspired by AppVeyor, Hangfire.Dashboard.Dark shows the hangfire dashboard in a beautiful theme.

## 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)
- Dark theme

## Setup

Expand All @@ -22,75 +17,15 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(config =>
{
config.UseSqlServerStorage("connectionSting");
config.UseConsole();
...
config.UseDarkDashboard();
});
}
```

Otherwise,
```c#
GlobalConfiguration.Configuration
.UseSqlServerStorage("connectionSting")
.UseConsole();
...
.UseDarkDashboard();
```

**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)
- **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)

## Log

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

Now you can write to console:

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

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

```c#
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](progress.png)

```c#
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()`.
Binary file removed dashboard.png
Binary file not shown.
Binary file removed progress.png
Binary file not shown.
7 changes: 3 additions & 4 deletions src/Hangfire.Dashboard.Dark/GlobalConfigurationExtensions.cs
@@ -1,9 +1,8 @@
using Hangfire.Dashboard;
using Hangfire.Dashboard.Extensions;
using Hangfire.Dashboard.Extensions;
using System;
using System.Reflection;

namespace Hangfire.Console
namespace Hangfire.Dashboard.Dark
{
/// <summary>
/// Provides extension methods to setup Hangfire.Dashboard.Dark
Expand All @@ -21,7 +20,7 @@ public static IGlobalConfiguration UseDarkDashboard(this IGlobalConfiguration co

// register dispatchers for CSS
var assembly = typeof(GlobalConfigurationExtensions).GetTypeInfo().Assembly;
DashboardRoutes.Routes.Append("/css[0-9]{3}", new EmbeddedResourceDispatcher(assembly, "Hangfire.Console.Resources.style.css"));
DashboardRoutes.Routes.Append("/css[0-9]{3}", new EmbeddedResourceDispatcher(assembly, "Hangfire.Dashboard.Dark.Resources.style.css"));

return configuration;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Hangfire.Dashboard.Dark/Properties/AssemblyInfo.cs
Expand Up @@ -7,7 +7,7 @@
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hangfire.Console")]
[assembly: AssemblyProduct("Hangfire.Dashboard.Dark")]
[assembly: AssemblyTrademark("")]

// Setting ComVisible to false makes the types in this assembly not visible
Expand All @@ -18,5 +18,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c18cbfcc-955b-4b21-b698-851cc56364af")]

[assembly: InternalsVisibleTo("Hangfire.Console.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

0 comments on commit 478088e

Please sign in to comment.