예제 #1
0
        public void Write(LogEntry entry)
        {
            switch (entry.Severity)
            {
                case Severity.Error: ++errorCount; break;
                case Severity.Warning: ++warningCount; break;
            }

            Entries.Add(entry);
        }
예제 #2
0
        public void Write(LogEntry entry)
        {
            switch (entry.Severity)
            {
                case Severity.Error: ++errorCount; break;
                case Severity.Warning : ++warningCount; break;
            #if !DIAGNOSTICS
                case Severity.Verbose: return;
            #endif
            }

            if (!string.IsNullOrEmpty(entry.Origin))
            {
                Console.WriteLine(Date + GetSeverityName(entry.Severity) + ": " + entry.Origin + ": " + entry.Message);
            }
            else
            {
                Console.WriteLine(Date + GetSeverityName(entry.Severity) + ": " + entry.Message);
            }
        }
예제 #3
0
        public void Write(LogEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            switch (entry.Severity)
            {
                case Severity.Error: ++errorCount; break;
                case Severity.Warning: ++warningCount; break;
            }

            output.WriteLine(
                "{0}({1},{2}): {3} {4}: {5}",
                entry.Location.FilePath,
                entry.HLocation.FirstLine,
                entry.HLocation.FirstColumn,
                GetSeverityName(entry.Severity),
                entry.Code,
                entry.Message);
        }
예제 #4
0
 public void Write(LogEntry entry)
 {
     var msg = MemberContext(entry) + entry.Message;
     switch (entry.Severity)
     {
         case Severity.Error:
             ++errorCount;
             logger.LogError(msg);
             break;
         case Severity.Message:
             ++warningCount;
             logger.LogMessage(msg);
             break;
         case Severity.Verbose:
             logger.LogVerbose(msg);
             break;
         case Severity.Warning:
         default:
             logger.LogWarning(msg);
             break;
     }
 }
예제 #5
0
 public void Write(LogEntry entry)
 {
     throw new SyntaxException(entry.Location, entry.HLocation, entry.Message);
 }
예제 #6
0
        private static string MemberContext(LogEntry entry)
        {
            if (string.IsNullOrEmpty(entry.Origin))
            {
                return "";
            }

            return entry.Origin + ": ";
        }
예제 #7
0
        public IntSet UnicodeName(string name)
        { 
            var result = IntSet.GetUnicodeCategory(name);
            if (result == null)
            {
                var entry = new LogEntry
                    {
                        Severity  = Severity.Error,
                        Message   = string.Format("Invalid unicode category '{0}'.", name),
                    };
                entry.Location  = Parsing.Location;
                entry.HLocation = Parsing.HLocation;

                Logging.Write(entry);
                return IntSet.Empty;
            }

            return result;
        }