Example #1
0
        public Logger(string title, Color titleColor, FontStyle titleStyle = FontStyle.Normal)
        {
            Title      = title;
            TitleColor = titleColor;
            TitleStyle = titleStyle;

            _richTextFactory = new RichTextFactory(2048);
            TitleBacked      = _richTextFactory
                               .Style(TitleStyle).Color(TitleColor).Text(Title)
                               .ToString(true);
        }
Example #2
0
        private Logger(string prefix, string title, Color titleColor, FontStyle titleStyle = FontStyle.Normal)
        {
            Title      = title;
            TitleColor = titleColor;
            TitleStyle = titleStyle;

            _richTextFactory = new RichTextFactory(2048);
            TitleBacked      = _richTextFactory
                               .UnstyledText(prefix)
                               .Style(TitleStyle).Color(TitleColor).Text(Title)
                               .ToString(true);
        }
Example #3
0
            public static string CreateExceptionMessageForRoutine(Routine routine, Exception exception)
            {
                var creationStackTrace = routine.GetCreationStackTraceInternal();
                var messageFactory     = RichTextFactory.New(exception.Message.Length + 200)
                                         .Text("Exception thrown inside routine ▸ ").Bold.Text(exception.GetType().ToString())
                                         .NewLine.Italic.Text("ROUTINE TYPE ▸ ").UnstyledText(routine.GetType().Namespace).UnstyledText(".")
                                         .Bold.Text(routine.GetType().Name)
                                         .NewLine.UnstyledText("▾ ▾ ▾ ▾ ▾")
                                         .NewLine.Bold.Text("▸ ▸ ▸ EXCEPTION ◂ ◂ ◂")
                                         .NewLine.UnstyledText(exception.Message)
                                         .NewLine
                                         .NewLine.Bold.Text("▸ ▸ ▸ STACK TRACE ◂ ◂ ◂")
                                         .NewLine.UnstyledText(StackTraceUtility.ExtractStringFromException(exception));

                messageFactory.NewLine.Bold.Text("▸ ▸ ▸ CREATION STACK TRACE ◂ ◂ ◂");
                messageFactory.NewLine.UnstyledText(
                    string.IsNullOrEmpty(creationStackTrace)
                            ? "You can call CreationStackTrace method at routine to show creation stack trace"
                            : creationStackTrace);

                return(messageFactory.ToString());
            }