示例#1
0
        public void ResolveImports(ITextProvider text, ISassDocument document, IDocumentManager documentManager)
        {
            try
            {
                if (Filename == null || Filename.Value == null)
                {
                    return;
                }

                var path = ImportResolver.ResolvePath(Filename.Value, text, document.Source.Directory);
                if (string.IsNullOrEmpty(path))
                {
                    return;
                }

                var importFile = new FileInfo(path);
                if (importFile.Exists)
                {
                    Document = documentManager.Import(importFile, document);
                }
            }
            catch (Exception ex)
            {
                OutputLogger.Log(ex, "Failed to process reference file.");
            }
        }
示例#2
0
        public static void Main()
        {
            var logger        = new OutputLogger();
            var warningLogger = new WarningLogger(logger);
            var errorLogger   = new ErrorLogger(new UpperCaseLoggerDecorator(logger));

            const string message = "decorator works!";

            logger.Log(message);
            warningLogger.Log(message);
            errorLogger.Log(message);
        }
示例#3
0
        public override void Log(ILogMessage message)
        {
            // Always pass the message to the inner logger.
            OutputLogger.Log(message);

            if ((int)message.Level >= (int)FileLoggerVerbosity)
            {
                lock (_lockObj)
                {
                    using (var writer = new StreamWriter(File.Open(OutputPath, FileMode.Append, FileAccess.Write)))
                    {
                        writer.WriteLine(message);
                    }
                }
            }
        }
        public void ResolveImports(ITextProvider text, ISassDocument document, IDocumentManager documentManager)
        {
            foreach (var file in Files)
            {
                try
                {
                    var path = file.ResolvePath(document.Source.Directory, text);
                    if (string.IsNullOrEmpty(path))
                    {
                        continue;
                    }

                    var importFile = new FileInfo(path);
                    if (importFile.Exists)
                    {
                        file.Document = documentManager.Import(importFile, document);
                    }
                }
                catch (Exception ex)
                {
                    OutputLogger.Log(ex, "Failed to process import file.");
                }
            }
        }