public static RaygunClient GetClient() { var assemblyInfo = typeof(App).Assembly.GetAttribute<AssemblyInformationalVersionAttribute>(); var client = new RaygunClient("uX5c/PiCVqF31xlEm3jShA==") { ApplicationVersion = assemblyInfo != null ? assemblyInfo.InformationalVersion : "Unknown Version" }; client.AddWrapperExceptions(typeof(AggregateException)); return client; }
/// <summary> /// Construct a sink that saves errors to the Raygun.io service. Properties are being send as userdata and the level is used as tag. The message is included inside the userdata. /// </summary> /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param> /// <param name="applicationKey">The application key as found on the Raygun website.</param> /// <param name="wrapperExceptions">If you have common outer exceptions that wrap a valuable inner exception which you'd prefer to group by, you can specify these by providing a list.</param> /// <param name="userNameProperty">Specifies the property name to read the username from. By default it is UserName. Set to null if you do not want to use this feature.</param> /// <param name="applicationVersionProperty">Specifies the property to use to retrieve the application version from. You can use an enricher to add the application version to all the log events. When you specify null, Raygun will use the assembly version.</param> public RaygunSink(IFormatProvider formatProvider, string applicationKey, IEnumerable<Type> wrapperExceptions = null, string userNameProperty = "UserName", string applicationVersionProperty = "ApplicationVersion") { if (string.IsNullOrEmpty(applicationKey)) throw new ArgumentNullException("applicationKey"); _formatProvider = formatProvider; _userNameProperty = userNameProperty; _applicationVersionProperty = applicationVersionProperty; _client = new RaygunClient(applicationKey); if (wrapperExceptions != null) _client.AddWrapperExceptions(wrapperExceptions); }