Skip to content

Instantly share code, notes, and snippets.

nblumhardt / PerMinuteInExcessOf.cs
Created Nov 17, 2015
Proof of concept rate limiting filter for Serilog
View PerMinuteInExcessOf.cs
using System;
using Serilog;
using Serilog.Configuration;
namespace ConsoleApplication8
static class Program
static void Main()
nblumhardt / Body.tmpl
Created Jul 31, 2014
Showing step summary in a deployment email with Octopus Deploy
View Body.tmpl
<h3>Task summary:</h3>
#{each step in Octopus.Step}
<li>#{step.Name | HtmlEscape} &mdash; <strong>#{step.Status.Code}</strong> #{step.Status.Error | HtmlEscape}
#{if step.Status.ErrorDetail}
<pre>#{step.Status.ErrorDetail | HtmlEscape}</pre>
nblumhardt / Example.ps1
Last active Nov 8, 2019
Seq from Powershell POC
View Example.ps1
Import-Module Seq
# Specify the Seq server URL; an -apiKey can also be provided.
# Any properties set here will be attached to all events.
$seq = Open-Seq "http://my-seq" -properties @{ Machine = $env:ComputerName }
# Simple information method
Send-SeqEvent $seq "Hello from PowerShell"
nblumhardt / Program.cs
Created Jun 25, 2014
Exception data enricher for Serilog
View Program.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Serilog;
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting.Json;
nblumhardt / gist:07c8046ffdcbd3d6b1fa
Created May 18, 2014
Seq configuration via AppSettings
View gist:07c8046ffdcbd3d6b1fa

1. Install Serilog.Extras.AppSettings

PM> Install-Package Serilog.Extras.AppSettings

2. Add the 'read' method to logger config

... = new LoggerConfiguration()
View Octopus.Features.IISWebSite_BeforePostDeploy.ps1
## --------------------------------------------------------------------------------------
## Configuration
## --------------------------------------------------------------------------------------
$ConfirmPreference = "None"
$isEnabled = $OctopusParameters["Octopus.Action.IISWebSite.CreateOrUpdateWebSite"]
if (!$isEnabled -or ![Bool]::Parse($isEnabled))
exit 0
nblumhardt / gist:8914175
Created Feb 10, 2014
An alternative to stack walking to add caller names to Serilog events
View gist:8914175
public static class LoggerExtensions
public static ILogger ForHere(
this ILogger logger,
[CallerFilePath] string sourceFile = null,
[CallerLineNumber] int sourceLine = 0)
return logger
.ForContext("SourceFile", sourceFile)
.ForContext("SourceLine", sourceLine);
View SlidingWindowReactor.cs
using Seq.Apps;
using Seq.Apps.LogEvents;
using System;
using System.Linq;
namespace Seq.Sample.SlidingWindows
/// <summary>
/// Counts events in a sliding time window, writing a message back to the
/// stream when a set threshold is reached.
nblumhardt / SampleReactor.cs
Created Dec 14, 2013
Just a simple example to show how plugins ("apps") consume data from the stream
View SampleReactor.cs
using Seq.Apps;
using Seq.Apps.LogEvents;
namespace Seq.BuiltIn.SampleApp
public class SampleReactor : Reactor, ISubscribeTo<LogEventData>
public void On(Event<LogEventData> evt)
if (evt.Data.Level == LogEventLevel.Error)
View After.js
var module = angular.module('octopusApp.projects');
module.controller('ProjectReleaseController', function ($scope, busy, $routeParams, pageTitle, octopusRepository, $q) {
var isLoading = $scope.isLoading = busy.create();
var projectId = $routeParams["id"];
var releaseVersion = $routeParams["version"];
var project, release, deploymentProcess;
isLoading.promise(octopusRepository.Projects.get(projectId).then(function (project2) {
project = project2;