LogInfo() public static méthode

public static LogInfo ( this task, string message ) : void
task this
message string
Résultat void
        public override bool Execute()
        {
            logger = new BuildLogger(BuildEngine);
            logger.LogInfo($"SqlPersistenceScriptBuilderTask (version {assemblyVersion}) Executing");

            var stopwatch = Stopwatch.StartNew();

            try
            {
                ValidateInputs();
                var innerTask = new InnerTask(AssemblyPath, IntermediateDirectory, ProjectDirectory, SolutionDirectory,
                                              logError: (error, file) =>
                {
                    logger.LogError(error, file);
                });
                innerTask.Execute();
            }
            catch (ErrorsException exception)
            {
                logger.LogError(exception.Message, exception.FileName);
            }
            catch (Exception exception)
            {
                logger.LogError(exception.ToFriendlyString());
            }
            finally
            {
                logger.LogInfo($"  Finished SqlPersistenceScriptBuilderTask {stopwatch.ElapsedMilliseconds}ms.");
            }
            return(!logger.ErrorOccurred);
        }
Exemple #2
0
    public virtual bool Execute()
    {
        Logger = new BuildLogger
        {
            BuildEngine = BuildEngine,
        };

        Logger.LogInfo(string.Format("Fody (version {0}) Executing", typeof(Processor).Assembly.GetName().Version));

        var stopwatch = Stopwatch.StartNew();

        try
        {
            Inner();
            return(!Logger.ErrorOccurred);
        }
        catch (Exception exception)
        {
            Logger.LogException(exception);
            return(false);
        }
        finally
        {
            Logger.LogInfo(string.Format("  Finished Fody {0}ms.", stopwatch.ElapsedMilliseconds));
        }
    }
        public override bool Execute()
        {
            logger = new BuildLogger(BuildEngine);
            logger.LogInfo($"ScriptBuilderTask (version {typeof(ScriptBuilderTask).Assembly.GetName().Version}) Executing");

            var stopwatch = Stopwatch.StartNew();

            try
            {
                if (!ValidateInputs())
                {
                    return false;
                }
                Inner();
            }
            catch (ErrorsException exception)
            {
                logger.LogError(exception.Message, exception.FileName);
            }
            catch (Exception exception)
            {
                logger.LogError(exception.ToFriendlyString());
            }
            finally
            {
                logger.LogInfo($"  Finished ScriptBuilderTask {stopwatch.ElapsedMilliseconds}ms.");
            }
            return !logger.ErrorOccurred;
        }
Exemple #4
0
    public virtual bool Execute()
    {
        Logger.LogInfo($"Fody (version {typeof (Processor).Assembly.GetName().Version}) Executing");

        var stopwatch = Stopwatch.StartNew();

        try
        {
            Inner();
            return(!Logger.ErrorOccurred);
        }
        catch (Exception exception)
        {
            Logger.LogException(exception);
            return(false);
        }
        finally
        {
            Logger.LogInfo($"  Finished Fody {stopwatch.ElapsedMilliseconds}ms.");
        }
    }
Exemple #5
0
    void FindWeavers()
    {
        var stopwatch = Stopwatch.StartNew();

        Logger.LogInfo("Finding weavers");
        ReadProjectWeavers();
        addinFinder = new AddinFinder
        {
            Logger = Logger,
            SolutionDirectoryPath = SolutionDirectoryPath
        };
        addinFinder.FindAddinDirectories();

        FindWeaverProjectFile();

        ConfigureWhenWeaversFound();

        ConfigureWhenNoWeaversFound();

        Logger.LogInfo(string.Format("Finished finding weavers {0}ms", stopwatch.ElapsedMilliseconds));
    }
Exemple #6
0
        public override bool Execute()
        {
            var referenceCopyLocalPaths = ReferenceCopyLocalFiles.Select(x => x.ItemSpec).ToList();

            var defineConstants = DefineConstants.GetConstants();
            var buildLogger     = new BuildLogger
            {
                BuildEngine = BuildEngine,
            };

            processor = new Processor
            {
                Logger                  = buildLogger,
                AssemblyFilePath        = AssemblyFile,
                IntermediateDirectory   = IntermediateDirectory,
                KeyFilePath             = KeyOriginatorFile ?? AssemblyOriginatorKeyFile,
                SignAssembly            = SignAssembly,
                ProjectDirectory        = ProjectDirectory,
                DocumentationFilePath   = DocumentationFile,
                References              = References,
                SolutionDirectory       = SolutionDirectoryFinder.Find(SolutionDirectory, NCrunchOriginalSolutionDirectory, ProjectDirectory),
                ReferenceCopyLocalPaths = referenceCopyLocalPaths,
                DefineConstants         = defineConstants,
                NuGetPackageRoot        = NuGetPackageRoot,
                MSBuildDirectory        = MSBuildThisFileDirectory,
                WeaverFilesFromProps    = GetWeaverFilesFromProps(),
                DebugSymbols            = GetDebugSymbolsType(),
                GenerateXsd             = GenerateXsd
            };
            var success = processor.Execute();

            if (success)
            {
                var weavers = processor.Weavers.Select(x => x.AssemblyName);
                ExecutedWeavers = string.Join(";", weavers) + ";";

                try
                {
                    File.WriteAllLines(IntermediateCopyLocalFilesCache, processor.ReferenceCopyLocalPaths);
                }
                catch (Exception ex)
                {
                    buildLogger.LogInfo("ProjectDirectory: " + ProjectDirectory);
                    buildLogger.LogInfo("IntermediateDirectory: " + IntermediateDirectory);
                    buildLogger.LogInfo("CurrentDirectory: " + Directory.GetCurrentDirectory());
                    buildLogger.LogInfo("AssemblyFile: " + AssemblyFile);
                    buildLogger.LogInfo("IntermediateCopyLocalFilesCache: " + IntermediateCopyLocalFilesCache);
                    buildLogger.LogError("Error writing IntermediateCopyLocalFilesCache: " + ex.Message);
                    return(false);
                }
            }
            else
            {
                if (File.Exists(IntermediateCopyLocalFilesCache))
                {
                    File.Delete(IntermediateCopyLocalFilesCache);
                }
            }

            return(success);
        }