Exemplo n.º 1
0
 /// <summary>
 /// Loads log plugins from the script, so errors are logged.
 /// </summary>
 /// <param name="script">
 /// The script to load the imports from.
 /// </param>
 /// <param name="loggers">
 /// The loggers collection to add the loggers to.
 /// </param>
 /// <param name="pluginResolver">
 /// The plugin resolver to use.
 /// </param>
 public static void LoadLogPlugins(Block script, LoggerCollection loggers, [CanBeNull] IPluginResolver pluginResolver)
 {
     if (pluginResolver != null)
     {
         new PluginLoader(pluginResolver.EnumerateAvailablePlugins().ToArray(), loggers).Visit(script);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExecutionContextImplementation"/> class.
 /// </summary>
 /// <param name="parentContext">
 /// The parent context.
 /// </param>
 /// <param name="filename">
 /// The filename.
 /// </param>
 public ExecutionContextImplementation([NotNull] ConnectQlContext parentContext, string filename)
 {
     this.Filename      = filename;
     this.ParentContext = parentContext;
     this.Messages      = new MessageWriter(filename);
     this.fileFormats   = new FileFormatsImplementation();
     this.loggers       = new LoggerCollection(parentContext.Loggers);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginLoader"/> class.
 /// </summary>
 /// <param name="plugins">The plugins.</param>
 /// <param name="loggers">The loggers.</param>
 private PluginLoader(IConnectQlPlugin[] plugins, LoggerCollection loggers)
 {
     this.plugins = plugins;
     this.context = new PluginContext(loggers);
     this.logger  = loggers;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginContext"/> class.
 /// </summary>
 /// <param name="loggers">
 /// The loggers.
 /// </param>
 public PluginContext(LoggerCollection loggers)
 {
     this.Loggers   = loggers;
     this.Functions = new ConnectQlFunctions(new Dictionary <string, IFunctionDescriptor>(), () => loggers);
 }