Skip to content

Instantly share code, notes, and snippets.

View ThomasArdal's full-sized avatar
🎢

Thomas Ardal ThomasArdal

🎢
View GitHub Profile
dasdasdas
@ThomasArdal
ThomasArdal / Startup.js
Created October 26, 2017 18:37
JSNLog and elmah.io
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddElmahIo("API_KEY", new Guid("LOG_ID"));
var api = ElmahioAPI.Create("API_KEY");
JavascriptLogging.OnLogging += loggingEventArgs =>
{
api.Messages.CreateAndNotify(new Guid("LOG_ID"), new CreateMessage
{
Title = loggingEventArgs.FinalMessage,
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:elmahio="http://www.nlog-project.org/schemas/NLog.Targets.Elmah.Io.xsd"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="C:\temp\internal-nlog.txt">
<extensions>
<add assembly="Elmah.Io.NLog" />
@ThomasArdal
ThomasArdal / ErrorHandler.js
Last active November 17, 2016 20:52
Error handler with elmah.io, javascript and Axios
//ELMAH.IO error Handler:
export class ElmahIoApiUrls
{
public static CreateMessage(logId: string)
{
return "https://elmah.io/api/v2/messages?logId=" + logId;
}
}
@ThomasArdal
ThomasArdal / log.php
Last active August 22, 2022 10:09
Example of how to manually log an exception from PHP to elmah.io.
// Test
function logErrorElmahIO($logID, $title, $application, $critical = '0', $detail = '', $user = '') {
$ch = curl_init();
if ($critical == '1') {
$criticalStatus = "500";
} else {
$criticalStatus = "100";
}
@ThomasArdal
ThomasArdal / MyApp.cs
Last active August 22, 2022 10:08
Example of how to log all unhandled errors in a Xamarin app to elmah.io.
using System;
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Elmah.Io.Client;
using Elmah.Io.Client.Models;
namespace App5
{
[Application]
@ThomasArdal
ThomasArdal / gist:58f781ec61ff2ffcf1635a7bc92eef07
Last active April 11, 2016 04:35
How to pin Git Shell to the taskbar (Windows 7/8)
I was looking how to pin Git Shell to the taskbar,
I got this answer from Github support (hope it can help other people) :
Hi Fabien,
Windows is annoying in that it doesn't let you pin certain items to the taskbar.
However, there is a clever way to trick it into allowing you to do this.
1) Right-click on the 'Git Shell' shortcut, click Properties and go to the 'Target' text box
2) Add the word 'explorer' in front of the line
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.ServiceBus.Messaging;
using Microsoft.WindowsAzure;
namespace AzureElasticsearchConsumer
using System.Threading;
using Microsoft.ServiceBus.Messaging;
using Microsoft.WindowsAzure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ThomasArdal
ThomasArdal / SomeClass.cs
Last active August 29, 2015 14:06
Decompiled try catch with exception filter
try
{
Program.DoSomeHttpRequest();
return;
}
catch
{
Console.WriteLine("Generic Error");
return;
}