コード例 #1
0
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
            // Convert the objects to a string.
            var message = new StringBuilder();

            for (int i = 0; i < objects.Length; i++)
            {
                message.Append(' ');
                message.Append(TypeConverter.ToString(objects[i]));
            }

            switch (style)
            {
            case FirebugConsoleMessageStyle.Regular:
            case FirebugConsoleMessageStyle.Information:
            case FirebugConsoleMessageStyle.Warning:
                _output.Log(message.ToString());
                break;

            case FirebugConsoleMessageStyle.Error:
                _output.Error(message.ToString());
                break;

            default:
                throw new ArgumentOutOfRangeException("style");
            }
        }
コード例 #2
0
        /// <summary>
        /// Logs a message to the console.
        /// </summary>
        /// <param name="style"> A style which influences the icon and text color. </param>
        /// <param name="objects"> The objects to output to the console. These can be strings or
        /// ObjectInstances. </param>
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
#if !SILVERLIGHT
            var original = Console.ForegroundColor;
            switch (style)
            {
                case FirebugConsoleMessageStyle.Information:
                    Console.ForegroundColor = ConsoleColor.White;
                    break;
                case FirebugConsoleMessageStyle.Warning:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    break;
                case FirebugConsoleMessageStyle.Error:
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;
            }
#endif

            // Convert the objects to a string.
            var message = new System.Text.StringBuilder();
            for (int i = 0; i < objects.Length; i++)
            {
                message.Append(' ');
                message.Append(TypeConverter.ToString(objects[i]));
            }

            // Output the message to the console.
            Console.WriteLine(message.ToString());


#if !SILVERLIGHT
            if (style != FirebugConsoleMessageStyle.Regular)
                Console.ForegroundColor = original;
#endif
        }
コード例 #3
0
        /// <summary>
        /// Logs a message to the console.
        /// </summary>
        /// <param name="style"> A style which influences the icon and text color. </param>
        /// <param name="objects"> The objects to output to the console. These can be strings or
        /// ObjectInstances. </param>
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
            var original = Console.ForegroundColor;

            switch (style)
            {
            case FirebugConsoleMessageStyle.Information:
                Console.ForegroundColor = ConsoleColor.White;
                break;

            case FirebugConsoleMessageStyle.Warning:
                Console.ForegroundColor = ConsoleColor.Yellow;
                break;

            case FirebugConsoleMessageStyle.Error:
                Console.ForegroundColor = ConsoleColor.Red;
                break;
            }
            // Convert the objects to a string.
            var message = new System.Text.StringBuilder();

            foreach (var t in objects)
            {
                message.Append(' ');
                message.Append(TypeConverter.ToString(t));
            }

            // Output the message to the console.
            Console.WriteLine(message.ToString());

            if (style != FirebugConsoleMessageStyle.Regular)
            {
                Console.ForegroundColor = original;
            }
        }
コード例 #4
0
        public void Log(FirebugConsoleMessageStyle style, string value)
        {
            var color = Console.ForegroundColor;

            switch (style)
            {
            case FirebugConsoleMessageStyle.Information:
                Console.ForegroundColor = ConsoleColor.White;
                break;

            case FirebugConsoleMessageStyle.Warning:
                Console.ForegroundColor = ConsoleColor.Yellow;
                break;

            case FirebugConsoleMessageStyle.Error:
                Console.ForegroundColor = ConsoleColor.Red;
                break;
            }

            string indent = new string(' ', Indentation);

            foreach (string line in NewlineRe.Split(value))
            {
                Console.WriteLine(indent + line);
            }

            Console.ForegroundColor = color;
        }
コード例 #5
0
        public void Log(FirebugConsoleMessageStyle style, string value)
        {
            string indent = new string(' ', Indentation);

            foreach (string line in NewlineRe.Split(value))
            {
                _sb.AppendLine(indent + line);
            }
        }
コード例 #6
0
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
            var baristaLogService = new BaristaDiagnosticsService(BaristaDiagnosticsService.DiagnosticsAreaName, SPFarm.Local);

            var cat = baristaLogService[BaristaDiagnosticCategory.Console];

            var output = new StringBuilder();

            for (var i = 0; i < objects.Length; i++)
            {
                if (i > 0)
                {
                    output.AppendLine();
                }
                if (objects[i] is ObjectInstance)
                {
                    output.AppendLine(JSONObject.Stringify(this.Engine, objects[i], null, null));
                }
                else
                {
                    output.AppendLine(TypeConverter.ToString(objects[i]));
                }
            }

            var severity = TraceSeverity.None;

            switch (style)
            {
            case FirebugConsoleMessageStyle.Error:
                severity = TraceSeverity.Unexpected;
                break;

            case FirebugConsoleMessageStyle.Information:
                severity = TraceSeverity.Verbose;
                break;

            case FirebugConsoleMessageStyle.Regular:
                severity = TraceSeverity.Medium;
                break;

            case FirebugConsoleMessageStyle.Warning:
                severity = TraceSeverity.Monitorable;
                break;
            }

            baristaLogService.WriteTrace(1, cat, severity, output.ToString(), baristaLogService.TypeName);
        }
コード例 #7
0
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
            var logger = LogManager.GetCurrentClassLogger();

            var output = new StringBuilder();

            for (var i = 0; i < objects.Length; i++)
            {
                if (i > 0)
                {
                    output.AppendLine();
                }
                if (objects[i] is ObjectInstance)
                {
                    output.AppendLine(JSONObject.Stringify(this.Engine, objects[i], null, null));
                }
                else
                {
                    output.AppendLine(TypeConverter.ToString(objects[i]));
                }
            }

            var severity = LogLevel.Trace;

            switch (style)
            {
            case FirebugConsoleMessageStyle.Error:
                severity = LogLevel.Error;
                break;

            case FirebugConsoleMessageStyle.Information:
                severity = LogLevel.Information;
                break;

            case FirebugConsoleMessageStyle.Regular:
                severity = LogLevel.Debug;
                break;

            case FirebugConsoleMessageStyle.Warning:
                severity = LogLevel.Warning;
                break;
            }

            logger.Log(severity, output.ToString);
        }
コード例 #8
0
        /// <summary>
        /// Logs a message to the console.
        /// </summary>
        /// <param name="style"> A style which influences the icon and text color. </param>
        /// <param name="objects"> The objects to output to the console. These can be strings or
        /// ObjectInstances. </param>
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
#if !SILVERLIGHT
            var original = Console.ForegroundColor;
            switch (style)
            {
            case FirebugConsoleMessageStyle.Information:
                Console.ForegroundColor = ConsoleColor.White;
                break;

            case FirebugConsoleMessageStyle.Warning:
                Console.ForegroundColor = ConsoleColor.Yellow;
                break;

            case FirebugConsoleMessageStyle.Error:
                Console.ForegroundColor = ConsoleColor.Red;
                break;
            }
#endif

            // Convert the objects to a string.
            var message = new System.Text.StringBuilder();
            for (int i = 0; i < objects.Length; i++)
            {
                message.Append(' ');
                message.Append((objects[i]));
            }

            // Output the message to the console.
            Console.WriteLine(message.ToString());


#if !SILVERLIGHT
            if (style != FirebugConsoleMessageStyle.Regular)
            {
                Console.ForegroundColor = original;
            }
#endif
        }
コード例 #9
0
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
            // Convert the objects to a string.
            var message = new StringBuilder();
            for (int i = 0; i < objects.Length; i++)
            {
                message.Append(' ');
                message.Append(TypeConverter.ToString(objects[i]));
            }

            switch (style)
            {
                case FirebugConsoleMessageStyle.Regular:
                case FirebugConsoleMessageStyle.Information:
                case FirebugConsoleMessageStyle.Warning:
                    _output.Log(message.ToString());
                    break;
                case FirebugConsoleMessageStyle.Error:
                    _output.Error(message.ToString());
                    break;
                default:
                    throw new ArgumentOutOfRangeException("style");
            }
        }
コード例 #10
0
        //     PRIVATE METHODS
        //_________________________________________________________________________________________

        /// <summary>
        /// Logs a message to the console.  The objects provided will be converted to strings then
        /// joined together in a space separated line.  The first parameter can be a string
        /// containing the following patterns:
        ///  %s	 String
        ///  %d, %i	 Integer
        ///  %f	 Floating point number
        /// </summary>
        /// <param name="style"> The style of the message (this determines the icon and text
        /// color). </param>
        /// <param name="items"> The items to format. </param>
        private void Log(FirebugConsoleMessageStyle style, params object[] items)
        {
            this.output.Log(style, FormatObjects(items));
        }
コード例 #11
0
            public void Log(FirebugConsoleMessageStyle style, string value)
            {
                value = NewlineRe.Replace(value ?? "", p => Environment.NewLine);

                _textEditor.BeginInvoke(new Action <string>(AppendText), value);
            }
コード例 #12
0
ファイル: FirebugConsole.cs プロジェクト: HaKDMoDz/GNet
        //     PRIVATE METHODS
        //_________________________________________________________________________________________

        /// <summary>
        /// Logs a message to the console.  The objects provided will be converted to strings then
        /// joined together in a space separated line.  The first parameter can be a string
        /// containing the following patterns:
        ///  %s	 String
        ///  %d, %i	 Integer
        ///  %f	 Floating point number
        /// </summary>
        /// <param name="style"> The style of the message (this determines the icon and text
        /// color). </param>
        /// <param name="items"> The items to format. </param>
        private void Log(FirebugConsoleMessageStyle style, params object[] items)
        {
            this.output.Log(style, FormatObjects(items));
        }
コード例 #13
0
 /// <summary>
 /// Logs a message to the console.
 /// </summary>
 /// <param name="style"> A style which influences the icon and text color. </param>
 /// <param name="objects"> The objects to output to the console. These can be strings or
 /// ObjectInstances. </param>
 public void Log(FirebugConsoleMessageStyle style, object[] objects)
 {
     Log((SilverlightMessageStyle)style, objects);
 }
コード例 #14
0
        private JsValue Log(FirebugConsoleMessageStyle style, JsValue thisObject, JsValue[] arguments)
        {
            Output.Log(style, Format(arguments));

            return(JsValue.Undefined);
        }
コード例 #15
0
 /// <summary>
 /// Logs a message to the console.
 /// </summary>
 /// <param name="style"> A style which influences the icon and text color. </param>
 /// <param name="objects"> The objects to output to the console. These can be strings or
 /// ObjectInstances. </param>
 public void Log(FirebugConsoleMessageStyle style, object[] objects)
 {
     Log((SilverlightMessageStyle)style, objects);
 }