Skip to content

Instantly share code, notes, and snippets.

@Clancey
Last active August 29, 2015 14:14
Show Gist options
  • Save Clancey/4e13c61adab63db4b219 to your computer and use it in GitHub Desktop.
Save Clancey/4e13c61adab63db4b219 to your computer and use it in GitHub Desktop.
Insights Logger
public static void Log (Exception ex, ReportSeverity severity= ReportSeverity.Error,
[CallerMemberName] string memberName = "",
[CallerFilePath] string sourceFilePath = "",
[CallerLineNumber] int sourceLineNumber = 0)
{
try{
Console.WriteLine (ex);
Console.WriteLine("{0} - {1} - {2} \r\n {3}",sourceFilePath,memberName,sourceLineNumber,ex);
Insights.Report (ex, new Dictionary<string,object>{
{"Method",memberName},
{"File Name",sourceFilePath},
{"Line Number",sourceLineNumber},
}, severity);
} catch (Exception ex1) {
Console.WriteLine (ex1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment