Example #1
0
        public void writeTest()
        {
            PjLog_Accessor target = new PjLog_Accessor(); // TODO: Initialize to an appropriate value
            string         logged = string.Empty;         // TODO: Initialize to an appropriate value
            PjLogLevel     level  = new PjLogLevel();     // TODO: Initialize to an appropriate value

            target.write(logged, level);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Example #2
0
        public void logTest1()
        {
            PjLog_Accessor target  = new PjLog_Accessor(); // TODO: Initialize to an appropriate value
            object         caller  = null;                 // TODO: Initialize to an appropriate value
            PjLogLevel     level   = new PjLogLevel();     // TODO: Initialize to an appropriate value
            string         message = string.Empty;         // TODO: Initialize to an appropriate value

            target.log(caller, level, message);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Example #3
0
 public void LogLevelTest()
 {
     PjLog_Accessor target = new PjLog_Accessor(); // TODO: Initialize to an appropriate value
     PjLogLevel expected = new PjLogLevel(); // TODO: Initialize to an appropriate value
     PjLogLevel actual;
     target.LogLevel = expected;
     actual = target.LogLevel;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #4
0
        public void LogLevelTest()
        {
            PjLog_Accessor target   = new PjLog_Accessor(); // TODO: Initialize to an appropriate value
            PjLogLevel     expected = new PjLogLevel();     // TODO: Initialize to an appropriate value
            PjLogLevel     actual;

            target.LogLevel = expected;
            actual          = target.LogLevel;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #5
0
        private void write(string logged, PjLogLevel level)
        {
            if (level <= LogLevel)
            {
                Console.Write(logged);
            }

            if (!IsSuspended)
            {
                //output to file
                StreamWriter writer = new StreamWriter(filename, true);
                writer.Write(logged);
                writer.Close();
            }
        }
Example #6
0
 public void writeTest()
 {
     PjLog_Accessor target = new PjLog_Accessor(); // TODO: Initialize to an appropriate value
     string logged = string.Empty; // TODO: Initialize to an appropriate value
     PjLogLevel level = new PjLogLevel(); // TODO: Initialize to an appropriate value
     target.write(logged, level);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Example #7
0
 public void logTest1()
 {
     PjLog_Accessor target = new PjLog_Accessor(); // TODO: Initialize to an appropriate value
     object caller = null; // TODO: Initialize to an appropriate value
     PjLogLevel level = new PjLogLevel(); // TODO: Initialize to an appropriate value
     string message = string.Empty; // TODO: Initialize to an appropriate value
     target.log(caller, level, message);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Example #8
0
        public void log(object caller, PjLogLevel level, string message)
        {
            DateTime      now          = DateTime.Now;
            StringBuilder finalMessage = new StringBuilder();

            if ((pLogDecoration & PjLogDecoration.HasLevelText) != 0)
            {
                finalMessage.Append(level.ToString() + ": ");
            }

            if ((pLogDecoration & PjLogDecoration.HasDayName) != 0)
            {
                finalMessage.Append(now.DayOfWeek.ToString() + ", ");
            }

            if ((pLogDecoration & PjLogDecoration.HasYear) != 0)
            {
                finalMessage.Append(now.Year + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasMonth) != 0)
            {
                finalMessage.Append(now.Month.ToString() + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasDayOfMonth) != 0)
            {
                finalMessage.Append(now.Day.ToString() + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasTime) != 0)
            {
                finalMessage.Append(now.ToLongTimeString());
            }

            if ((pLogDecoration & PjLogDecoration.HasMicroSec) != 0)
            {
                finalMessage.Append("." + now.Millisecond + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasSender) != 0)
            {
                if (caller != null)
                {
                    finalMessage.Append("[" + caller.ToString() + "] ");
                }
            }

            if ((pLogDecoration & PjLogDecoration.HasThreadID) != 0)
            {
                finalMessage.Append("<" + Thread.CurrentThread.ManagedThreadId.ToString() + "> ");
            }

            finalMessage.Append(" ~ " + message);

            if ((pLogDecoration & PjLogDecoration.HasCR) != 0)
            {
                finalMessage.Append("\r");
            }

            if ((pLogDecoration & PjLogDecoration.HasNewLine) != 0)
            {
                finalMessage.Append("\n");
            }

            write(finalMessage.ToString(), level);
        }
Example #9
0
        public void log(object caller, PjLogLevel level, string message)
        {
            DateTime now = DateTime.Now;
            StringBuilder finalMessage = new StringBuilder();
            if ((pLogDecoration & PjLogDecoration.HasLevelText) != 0)
            {
                finalMessage.Append(level.ToString() + ": ");
            }

            if ((pLogDecoration & PjLogDecoration.HasDayName) != 0) 
            {
                finalMessage.Append(now.DayOfWeek.ToString() + ", ");
            }

            if ((pLogDecoration & PjLogDecoration.HasYear) != 0)
            {
                finalMessage.Append(now.Year + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasMonth) != 0)
            {
                finalMessage.Append(now.Month.ToString() + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasDayOfMonth) != 0)
            {
                finalMessage.Append(now.Day.ToString() + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasTime) != 0)
            {
                finalMessage.Append(now.ToLongTimeString());
            }

            if ((pLogDecoration & PjLogDecoration.HasMicroSec) != 0)
            {
                finalMessage.Append("." + now.Millisecond + " ");
            }

            if ((pLogDecoration & PjLogDecoration.HasSender) != 0)
            {
                if (caller != null)
                    finalMessage.Append("[" + caller.ToString() + "] ");
            }

            if ((pLogDecoration & PjLogDecoration.HasThreadID) != 0)
            {
                finalMessage.Append("<" + Thread.CurrentThread.ManagedThreadId.ToString() + "> ");
            }

            finalMessage.Append(" ~ " + message);

            if ((pLogDecoration & PjLogDecoration.HasCR) != 0)
            {
                finalMessage.Append("\r");
            }

            if ((pLogDecoration & PjLogDecoration.HasNewLine) != 0)
            {
                finalMessage.Append("\n");
            }

            write(finalMessage.ToString(), level);
        }
Example #10
0
        private void write(string logged, PjLogLevel level)
        {
            if (level <= LogLevel)
            {
                Console.Write(logged);
            }

            if (!IsSuspended)
            {
                //output to file
                StreamWriter writer = new StreamWriter(filename, true);
                writer.Write(logged);
                writer.Close();
            }
        }