public static void UseTraceLogEntriesPlugin(this ExceptionlessConfiguration config, int? defaultMaxEntriesToInclude = null) {
            int maxEntriesToInclude = config.Settings.GetInt32(TraceLogPlugin.MaxEntriesToIncludeKey, defaultMaxEntriesToInclude ?? 0);

            if (!Trace.Listeners.OfType<ExceptionlessTraceListener>().Any())
                Trace.Listeners.Add(new ExceptionlessTraceListener(maxEntriesToInclude));

            if (!config.Settings.ContainsKey(TraceLogPlugin.MaxEntriesToIncludeKey) && defaultMaxEntriesToInclude.HasValue)
                config.Settings.Add(TraceLogPlugin.MaxEntriesToIncludeKey, maxEntriesToInclude.ToString());

            config.AddPlugin(typeof(TraceLogPlugin).Name, 70, c => new TraceLogPlugin(c));
        }
Example #2
0
        public static void Load(this IPluginHost host, string filepath, params Assembly[] pluginAssemblies)
        {
            host.ClearPlugins();

            using (XmlReader reader = XmlReader.Create(filepath))
            {
                bool started = false;
                while (reader.Read())
                {
                    if (reader.MoveToContent() == XmlNodeType.Element)
                    {
                        if (reader.Name == "PluginHost")
                        {
                            if (started)
                                throw new Exception("Parent nodes cannot be nested");

                            started = true;
                        }
                        else if (!started)
                            throw new Exception("A parent node of type 'PluginHost' must be included");
                        else if (reader.Name == "Plugin")
                        {
                            string type = reader.GetAttribute("type");
                            Plugin plugin = GetPlugin(type, pluginAssemblies);
                            if (plugin == null)
                                throw new DependencyNotFoundException("Plugin " + type + " not found");

                            plugin.Load(reader.ReadSubtree());
                            host.AddPlugin(plugin);
                        }
                        else
                            throw new NotSupportedException(reader.Name);
                    }
                }
            }
        }
 /// <summary>
 /// Reads the Exceptionless configuration from the app.config or web.config file.
 /// </summary>
 /// <param name="config">The configuration object you want to apply the attribute settings to.</param>
 public static void UseErrorPlugin(this ExceptionlessConfiguration config) {
     config.RemovePlugin<SimpleErrorPlugin>();
     config.AddPlugin<Plugins.ErrorPlugin>();
 }
 /// <summary>
 /// Automatically set a reference id for error events.
 /// </summary>
 public static void UseReferenceIds(this ExceptionlessConfiguration config) {
     config.AddPlugin<ReferenceIdPlugin>();
 }
        /// <summary>
        /// Automatically send session start, session heartbeats and session end events.
        /// </summary>
        /// <param name="config">Exceptionless configuration</param>
        /// <param name="sendHeartbeats">Controls whether heartbeat events are sent on an interval.</param>
        /// <param name="heartbeatInterval">The interval at which heartbeats are sent after the last sent event. The default is 1 minutes.</param>
        /// <param name="useSessionIdManagement">Allows you to manually control the session id. This is only recommended for single user desktop environments.</param>
        public static void UseSessions(this ExceptionlessConfiguration config, bool sendHeartbeats = true, TimeSpan? heartbeatInterval = null, bool useSessionIdManagement = false) {
            config.SessionsEnabled = true;

            if (useSessionIdManagement)
                config.AddPlugin<SessionIdManagementPlugin>();

            if (sendHeartbeats)
                config.AddPlugin(new HeartbeatPlugin(heartbeatInterval));
            else
                config.RemovePlugin<HeartbeatPlugin>();
        }
        public static void UseSessions(this ExceptionlessConfiguration config, bool sendHeartbeats = true) {
            config.SessionsEnabled = true;

            if (sendHeartbeats)
                config.AddPlugin<HeartbeatPlugin>();
        }