Exemplo n.º 1
0
 protected override string AppendNormal(L4j level, string title, string message)
 {
     if (!level.Polarity()) WriteBlankLine();
     Write2Cols(ColorFor(level), title, message);
     if (!level.Polarity()) WriteBlankLine();
     return GetText();
 }
Exemplo n.º 2
0
        private ColorDescriptor ColorFor(L4j level)
        {
            switch (level)
            {
            case L4j.Fatal: return(_fatal ?? (_fatal
                                                  = _doc.createColor(Color.Red)));

            case L4j.Error: return(_error ?? (_error
                                                  = _doc.createColor(Color.Red)));

            case L4j.Warn: return(_warn ?? (_warn
                                                = _doc.createColor(Color.Yellow)));

            case L4j.Info: return(_info ?? (_info
                                                = _doc.createColor(Color.White)));

            case L4j.Debug: return(_debug ?? (_debug
                                                  = _doc.createColor(Color.DarkGray)));

            case L4j.Trace: return(_trace ?? (_trace
                                                  = _doc.createColor(Color.SlateGray)));

            case L4j.Off: return(_off ?? (_off
                                              = _doc.createColor(Color.Transparent)));

            default:
                throw Error.Unsupported(level);
            }
        }
Exemplo n.º 3
0
        private ColorDescriptor ColorFor(L4j level)
        {
            switch (level)
            {
                case L4j.Fatal: return _fatal ?? (_fatal
                    = _doc.createColor(Color.Red));

                case L4j.Error: return _error ?? (_error
                    = _doc.createColor(Color.Red));

                case L4j.Warn: return _warn ?? (_warn
                    = _doc.createColor(Color.Yellow));

                case L4j.Info: return _info ?? (_info
                    = _doc.createColor(Color.White));

                case L4j.Debug: return _debug ?? (_debug
                    = _doc.createColor(Color.DarkGray));

                case L4j.Trace: return _trace ?? (_trace
                    = _doc.createColor(Color.SlateGray));

                case L4j.Off: return _off ?? (_off 
                    = _doc.createColor(Color.Transparent));

                default:
                    throw Error.Unsupported(level);
            }
        }
Exemplo n.º 4
0
 private static void TestLevel(this ConsoleControl.ConsoleControl cons,
                               L4j level)
 {
     cons.Write3Cols(GetColor(level),
                     "SomeObjectAsSouce",
                     "Testing [{0}] level".f(level),
                     "This is a sampler of level {0}.".f(level));
 }
Exemplo n.º 5
0
        protected override string AppendNormal(L4j level, string title, string message)
        {
            var p = _doc.addParagraph();
            p.DefaultCharFormat.Font = _consolas;
            p.DefaultCharFormat.FontSize = 10.667F;
            p.DefaultCharFormat.FgColor = ColorFor(level);

            p.setText(Concat(title, message));
            return _doc.render();
        }
Exemplo n.º 6
0
        public void LogNormal(L4j level, string col1, string col2)
        {
            //if (!level.Polarity()) cons.BlankLine();
            if (level == L4j.Error) cons.BlankLine();

            cons.Write2Cols(ColorFor(level), col1, col2);

            //if (!level.Polarity()) cons.BlankLine();
            if (level == L4j.Error) cons.BlankLine();
        }
Exemplo n.º 7
0
        protected override string AppendNormal(L4j level, string title, string message)
        {
            var p = _doc.addParagraph();

            p.DefaultCharFormat.Font     = _consolas;
            p.DefaultCharFormat.FontSize = 10.667F;
            p.DefaultCharFormat.FgColor  = ColorFor(level);

            p.setText(Concat(title, message));
            return(_doc.render());
        }
Exemplo n.º 8
0
        public static bool Polarity(this L4j level)
        {
            switch (level)
            {
            case L4j.Info:
            case L4j.Debug:
            case L4j.Trace: return(true);

            default: return(false);
            }
        }
Exemplo n.º 9
0
 protected override string AppendNormal(L4j level, string title, string message)
 {
     if (!level.Polarity())
     {
         WriteBlankLine();
     }
     Write2Cols(ColorFor(level), title, message);
     if (!level.Polarity())
     {
         WriteBlankLine();
     }
     return(GetText());
 }
Exemplo n.º 10
0
 protected override Brush ColorFor(L4j level)
 {
     switch (level)
     {
         case L4j.Fatal : return Brushes.Red;
         case L4j.Error : return Brushes.Red;
         case L4j.Warn  : return Brushes.Yellow;
         case L4j.Info  : return Brushes.White;
         case L4j.Debug : return Brushes.DarkGray;
         case L4j.Trace : return Brushes.SlateGray;
         case L4j.Off   : return Brushes.Transparent;
         default:
             throw Error.Unsupported(level, "color map");
     }
 }
Exemplo n.º 11
0
        public void LogNormal(L4j level, string col1, string col2)
        {
            //if (!level.Polarity()) cons.BlankLine();
            if (level == L4j.Error)
            {
                cons.BlankLine();
            }

            cons.Write2Cols(ColorFor(level), col1, col2);

            //if (!level.Polarity()) cons.BlankLine();
            if (level == L4j.Error)
            {
                cons.BlankLine();
            }
        }
Exemplo n.º 12
0
        private static Color ColorFor(L4j level)
        {
            switch (level)
            {
            case L4j.Fatal: return(Color.Red);

            case L4j.Error: return(Color.Red);

            case L4j.Warn: return(Color.Yellow);

            case L4j.Info: return(Color.White);

            case L4j.Debug: return(Color.DarkGray);

            case L4j.Trace: return(Color.SlateGray);

            default:
                throw Error.Unsupported(level, "color map");
            }
        }
Exemplo n.º 13
0
        private bool Arg(L4j level, ShowLogAs showAs, string title, string message)
        {
            if (level == L4j.Off)
            {
                return(false);
            }

            var e = new LogEventArg
            {
                Level   = level,
                ShowAs  = showAs,
                Title   = title,
                Message = message
            };

            try   { _logAdded?.Invoke(this, e); }
            catch { }

            return(e.Level.Polarity());
        }
Exemplo n.º 14
0
        protected override Brush ColorFor(L4j level)
        {
            switch (level)
            {
            case L4j.Fatal: return(Brushes.Red);

            case L4j.Error: return(Brushes.Red);

            case L4j.Warn: return(Brushes.Yellow);

            case L4j.Info: return(Brushes.White);

            case L4j.Debug: return(Brushes.DarkGray);

            case L4j.Trace: return(Brushes.SlateGray);

            case L4j.Off: return(Brushes.Transparent);

            default:
                throw Error.Unsupported(level, "color map");
            }
        }
Exemplo n.º 15
0
 public void LogHeader(L4j level, string title, string subTitle)
 {
     cons.BlankLine();
     cons.Write2Cols(ColorFor(level), title, subTitle);
 }
Exemplo n.º 16
0
 public void LogHeader(L4j level, string title, string subTitle)
 {
     cons.BlankLine();
     cons.Write2Cols(ColorFor(level), title, subTitle);
 }
Exemplo n.º 17
0
 protected override string AppendHeader(L4j level, string title, string subTitle)
 {
     WriteBlankLine();
     Write2Cols(ColorFor(level), title, subTitle);
     return(GetText());
 }
Exemplo n.º 18
0
 protected abstract Brush   ColorFor(L4j level);
Exemplo n.º 19
0
 protected override string AppendOutro(L4j level, string text)
 {
     WriteCol2of2(ColorFor(level), text);
     return GetText();
 }
Exemplo n.º 20
0
 private NotificationType Notifier(L4j level)
 {
     return(new NotificationType(level.ToString(), $"Level : ‹{level}›"));
 }
Exemplo n.º 21
0
 public bool Normal_(L4j level, object title, object message, params object[] args)
 {
     return(Arg(level, ShowLogAs.Normal, title.ToString(), message.ToString().f(args)));
 }
Exemplo n.º 22
0
 protected abstract string AppendNormal(L4j level, string title, string message);
Exemplo n.º 23
0
 private static Color ColorFor(L4j level)
 {
     switch (level)
     {
         case L4j.Fatal: return Color.Red;
         case L4j.Error: return Color.Red;
         case L4j.Warn: return Color.Yellow;
         case L4j.Info: return Color.White;
         case L4j.Debug: return Color.DarkGray;
         case L4j.Trace: return Color.SlateGray;
         default:
             throw Error.Unsupported(level, "color map");
     }
 }
Exemplo n.º 24
0
 protected abstract string AppendHeader (L4j level, string title, string subTitle);
Exemplo n.º 25
0
 protected override string AppendHeader(L4j level, string title, string message)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 26
0
 public void LogOutro(L4j level, string text)
 {
     cons.WriteLine(ColorFor(level), text);
 }
Exemplo n.º 27
0
 public void LogIntro(L4j level, string text)
 {
     cons.WriteCol1of2(ColorFor(level), text);
 }
Exemplo n.º 28
0
 protected abstract string AppendOutro(L4j level, string text);
Exemplo n.º 29
0
 public bool Intro_(L4j level, object title, params object[] args)
 {
     return(Arg(level, ShowLogAs.Intro, title.ToString().f(args), ""));
 }
Exemplo n.º 30
0
 protected abstract string AppendHeader(L4j level, string title, string subTitle);
Exemplo n.º 31
0
 public bool Outro_(L4j level, object message, params object[] args)
 {
     return(Arg(level, ShowLogAs.Outro, "", message.ToString().f(args)));
 }
Exemplo n.º 32
0
 protected override string AppendHeader(L4j level, string title, string subTitle)
 {
     WriteBlankLine();
     Write2Cols(ColorFor(level), title, subTitle);
     return GetText();
 }
Exemplo n.º 33
0
 public void LogOutro(L4j level, string text)
 {
     cons.WriteLine(ColorFor(level), text);
 }
Exemplo n.º 34
0
 protected abstract Brush   ColorFor       (L4j level);
Exemplo n.º 35
0
 public void LogIntro(L4j level, string text)
 {
     cons.WriteCol1of2(ColorFor(level), text);
 }
Exemplo n.º 36
0
 protected abstract string AppendOutro  (L4j level, string text);
Exemplo n.º 37
0
 protected override string AppendHeader(L4j level, string title, string message)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 38
0
 protected override string AppendOutro(L4j level, string text)
 {
     WriteCol2of2(ColorFor(level), text);
     return(GetText());
 }
Exemplo n.º 39
0
 protected override string AppendOutro(L4j level, string text)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 40
0
 protected abstract string AppendNormal (L4j level, string title, string message);
Exemplo n.º 41
0
 protected override string AppendOutro(L4j level, string text)
 {
     throw new NotImplementedException();
 }