Example #1
0
        private static LoggerHandler GetLoggerHandler(string controllerName, string actionName)
        {
            if (string.IsNullOrWhiteSpace(controllerName))
            {
                throw new ArgumentNullException(nameof(controllerName));
            }

            if (string.IsNullOrWhiteSpace(actionName))
            {
                throw new ArgumentNullException(nameof(actionName));
            }

            var key     = GetCacheKey(controllerName, actionName);
            var handler = _cache.GetValue(key) as LoggerHandler;

            if (handler == null)
            {
                handler = new LoggerHandler(key, new TextFileLogger()
                {
                    FilePath = "logs/args/" + controllerName + "_" + actionName + "/${binding:timestamp#yyyyMM}/${binding:source}[{sequence}].log"
                }, new LoggerHandlerPredication()
                {
                    MinLevel = LogLevel.Debug,
                    MaxLevel = LogLevel.Info
                });

                // 将日志记录处理程序加入缓存。
                _cache.SetValue(key, handler);
            }

            return(handler);
        }
Example #2
0
        public void MyTestMethod1NUnit()
        {
            LoggerHandler.WriteToLog("Start MyTestMethod1NUnit");
            //1

            LoginPageStep.SignIn(user2.Email, user2.Password);
            //2
            InBoxPageStep.SendMassage(user1.Email, "Test", Serves.GetCountry());
            //3
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user1.Email, user1.Password);
            //4
            InBoxPageStep.MoveMailIntoSpam(user2.Email);
            //5
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user2.Email, user2.Password);
            //6
            InBoxPageStep.SendMassage(user1.Email, "Test2", "Hello");
            //7
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user1.Email, user1.Password);
            //8
            InBoxPageStep.GoToSpam();
            //assert
            Assert.IsTrue(InBoxPageStep.CheckLetter(user2.Email, "Test2"));
            //clear
            LoggerHandler.WriteToLog("Finish MyTestMethod1NUnit");
        }
        //this function accepts the parameter as function name which logs to the console.writeline

        public void LogMessages(LoggerHandler delObj, string msg)
        {
            if (delObj != null)
            {
                Console.WriteLine("Calling the function to be invoked..!");
                delObj(msg);
                Console.WriteLine("Calling the function Completed..!");
            }
        }
Example #4
0
 /// <summary>
 ///     日志记录
 /// </summary>
 /// <param name="str"></param>
 public virtual void MessageLog(string str, MsgType type)
 {
     if (LoggerHandler != null)
     {
         LoggerHandler.MessageLog(str, this.QQ, type);
     }
     else
     {
         Console.WriteLine($"{DateTime.Now.ToString()}--{str}");
     }
 }
    }                                                          //fixedUpdate次数
    void Awake()
    {
        LoggerHandler.Init();
        LoggerNet.StartNetService();

        Debugger.Instance.Init();

        DontDestroyOnLoad(this);
        GameSystem.Instance.mEngineFramework = this;
        GameSystem.Instance.Start();
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
    }
        public static void Main(string[] args)
        {
            var loggerHandler = new LoggerHandler();

            var user =
                new User(
                    1,
                    "UsuarioTeste",
                    DateTime.Now);

            loggerHandler.HandleLog(user);
        }
Example #7
0
 void Type(String text)
 {
     try
     {
         WaitUntilVisible(this.by);
         WrappedElement.SendKeys(text);
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"Text can't be enter in {name}", ex);
     }
 }
Example #8
0
 public string GetText()
 {
     try
     {
         return(WrappedElement.Text);
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog("Text is absent in {name}", ex);
         return(null);
     }
 }
Example #9
0
        public static void Main(string[] args)
        {
            ILoggerHandler log = new LoggerHandler();

            log.Initialize(LoggerProviderType.Console);
            //log.Initialize(LoggerProviderType.Database);
            //log.Initialize(LoggerProviderType.File);
            //log.Initialize(LoggerProviderType.All);

            log.WriteMessage("Message sent");
            log.WriteWarning("Warning found");
            log.WriteError("Error ocurred");
            Console.ReadKey();
        }
Example #10
0
 public void Click()
 {
     try
     {
         WaitUntilVisible(this.by);
         WaitUntilClickable(this.by);
         WrappedElement.Click();
         LoggerHandler.WriteToLog($"RadioButton was {name} clicked");
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"RadioButton wasn't {name} clicked", ex);
     }
 }
Example #11
0
 public void MyTestMethod5NUnit()
 {
     LoggerHandler.WriteToLog("Start MyTestMethod12NUnit");
     LoginPageStep.SignIn(user3.Email, user3.Password);
     InBoxPageStep.AddEmoticons(user1.Email, "Emoticons");
     Assert.IsTrue(InBoxPageStep.EmoticonsIsPresent());
     InBoxPageStep.ChooseEmotionsIcons(Int32.Parse(Resource1.CountOfEmoticons));
     InBoxPageStep.GoToInBoxPage();
     InBoxPageStep.SignOutAccount();
     LoginPageStep.SignIn(user1.Email, user1.Password);
     InBoxPageStep.ClickOnLinkInMail(user3.Email);
     Assert.IsTrue(InBoxPageStep.EmoticonsIsPresentInMail());
     LoggerHandler.WriteToLog("Finish MyTestMethod5NUnit");
 }
Example #12
0
 public void Click()
 {
     try
     {
         WaitUntilVisible(this.by);
         WaitUntilClickable(this.by);
         WrappedElement.Click();
         LoggerHandler.WriteToLog($"Button Click {name}");
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"Button {name} Unclickable", ex);
     }
 }
Example #13
0
 public void ClearAndType(String text)
 {
     try
     {
         WaitUntilVisible(this.by);
         WrappedElement.Clear();
         WrappedElement.SendKeys(text);
         LoggerHandler.WriteToLog($"Enter the text in {name}");
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"Text can't be enter in {name}", ex);
     }
 }
Example #14
0
        public void MyTestMethod12NUnit()
        {
            LoggerHandler.WriteToLog("Start MyTestMethod12NUnit");
            string signature = Resource1.Signature;

            LoginPageStep.SignIn(user2.Email, user2.Password);
            InBoxPageStep.ChooseSettings();
            GeneralPageStep.InputSignature(signature);
            Assert.AreEqual(signature, InBoxPageStep.GetSignature());
            //clear
            InBoxPageStep.CloseFormForMail();
            InBoxPageStep.ChooseSettings();
            GeneralPageStep.DeleteSignature();
            LoggerHandler.WriteToLog("Finish MyTestMethod12NUnit");
        }
Example #15
0
        public void MyTestMethod2()
        {
            LoggerHandler.WriteToLog("Start MyTestMethod1NUnit");
            //1

            LoginPageStep.SignIn(user2.Email, user2.Password);
            //2
            InBoxPageStep.ChooseSettings();
            //4
            SettingPageStep.ForwardMail();
            //5
            ForwardPageStep.AddForwordingAddress(user3.Email);
            //6
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user3.Email, user3.Password);
            //7
            InBoxPageStep.ClickOnLinkInMail("*****@*****.**");
            MessageStep.ConfirmForwarding();
            //8
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user2.Email, user2.Password);
            //9,10
            InBoxPageStep.ChooseSettings();
            SettingPageStep.ForwardMail();
            ForwardPageStep.SaveRBChange();

            //11,12
            ForwardPageStep.SetFilterSettings(user1.Email);
            //13
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user1.Email, user1.Password);
            //15
            InBoxPageStep.SendMassage(user2.Email, "Test3", "Hello");
            //14
            InBoxPageStep.SendMassageWithAttach(user2.Email, "Test4", "File", Resource1.PathToFile);
            //16
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user2.Email, user2.Password);
            //asssert
            Assert.IsTrue(TrashPageStep.CheckLetterInTrash(user1.Email, "Test4"));
            //Assert.IsTrue(ImportantPageStep.CheckLetterInImportant(user1.Email, "Test4", "Test3"));
            Assert.IsTrue(InBoxPageStep.CheckLetter(user1.Email, "Test3"));
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user3.Email, user3.Password);
            Assert.IsTrue(InBoxPageStep.CheckLetter(user1.Email, "Test3"));

            LoggerHandler.WriteToLog("Finish MyTestMethod1NUnit");
        }
Example #16
0
 public void MyTestMethod3NUnit()
 {
     //var path = Environment.CurrentDirectory;
     //string path2 = $@"{path}\1.rar";
     LoggerHandler.WriteToLog("Start MyTestMethod3NUnit");
     //1
     LoginPageStep.SignIn(user1.Email, user1.Password);
     //2,3,4
     InBoxPageStep.SendMassageWithAttach(user2.Email, "Test5", "File", Resource1.PathToBigFile);
     //InBoxPageStep.SendMassageWithAttach(user2.Email, "Test5", "File", path2);
     //allert
     Assert.IsTrue(InBoxPageStep.AlertIsPresent());
     //clear
     InBoxPageStep.CancelAlert();
     LoggerHandler.WriteToLog("Finish MyTestMethod2NUnit");
 }
Example #17
0
 public void MyTestMethod11NUnit()
 {
     LoggerHandler.WriteToLog("Start MyTestMethod11NUnit");
     LoginPageStep.SignIn(user2.Email, user2.Password);
     //2
     InBoxPageStep.SendMassage(user1.Email, "Test6", "Hello");
     //3
     InBoxPageStep.SignOutAccount();
     LoginPageStep.SignIn(user1.Email, user1.Password);
     //4
     InBoxPageStep.MoveMailIntoSpam(user2.Email);
     InBoxPageStep.GoToSpam();
     InBoxPageStep.MoveMailFromSpam(user2.Email);
     InBoxPageStep.GoToInBoxPage();
     Assert.IsTrue(InBoxPageStep.CheckLetter(user2.Email, "Test6"));
     LoggerHandler.WriteToLog("Finish MyTestMethod11NUnit");
 }
Example #18
0
 public void Select()
 {
     try
     {
         if (!Selected)
         {
             WaitUntilVisible(this.by);
             WaitUntilClickable(this.by);
             WrappedElement.Click();
             LoggerHandler.WriteToLog($"CheckBox {name} Selected");
         }
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"CheckBox {name} can't be select", ex);
     }
 }
Example #19
0
        public void TestCleanup()
        {
            LoggerHandler.WriteToLog("Start TestCleanup");
            InBoxPageStep.SignOutAccount();
            LoginPageStep.SignIn(user1.Email, user1.Password);
            InBoxPageStep.GoToSpam();
            InBoxPageStep.MoveMailFromSpam(user1.Email);
            InBoxPageStep.DeleteAllMail();
            InBoxPageStep.SignOutAccount();

            /*LoginPageStep.SignIn(user2.Email, user2.Password);
             * InBoxPageStep.DeleteAllMail();
             * LoginPageStep.SignIn(user3.Email, user3.Password);
             * InBoxPageStep.DeleteAllMail();
             * InBoxPageStep.SignOutAccount();*/

            Step.ClosePage();
        }
Example #20
0
        private void LogCaller(LoggerEventArgs args)
        {
            string eMessage = String.Empty;

            if (args.Exception != null)
            {
                eMessage = args.Exception.Message;
            }

            AddLog(new Log(args.LogType, args.Message, eMessage));

            LoggerHandler caller = OnLog;

            if (caller != null)
            {
                caller(this, args);
            }
        }
Example #21
0
        public void MyTestMethod4NUnit()
        {
            string Path = TestContext.CurrentContext.TestDirectory;

            LoggerHandler.WriteToLog("Start MyTestMethod4NUnit");
            //1
            LoginPageStep.SignIn(user2.Email, user2.Password);
            InBoxPageStep.ChooseSettings();
            //2
            SettingPageStep.GoToThemes();
            //ThemePageStep.SetTheme(Resource1.Theme);
            ThemePageStep.SetTheme(Path + "\\log.jpg");
            //assert
            Assert.IsTrue(ThemePageStep.CheckMessageIsPresent());
            //clear
            ThemePageStep.CloseWindow();
            LoggerHandler.WriteToLog("Finish MyTestMethod4NUnit");
        }
Example #22
0
File: KCP.cs Project: niuniuzhu/RC
 // create a new kcp control object, 'conv' must equal in two endpoint
 // from the same connection.
 public KCP(uint conv, uint user, OutputHandler output, LoggerHandler writelog)
 {
     this._conv     = conv;
     this._user     = user;
     this._sndWnd   = IKCP_WND_SND;
     this._rcvWnd   = IKCP_WND_RCV;
     this._rmtWnd   = IKCP_WND_RCV;
     this._mtu      = IKCP_MTU_DEF;
     this._mss      = this._mtu - IKCP_OVERHEAD;
     this._rxRto    = IKCP_RTO_DEF;
     this._rxMinrto = IKCP_RTO_MIN;
     this._interval = IKCP_INTERVAL;
     this._tsFlush  = IKCP_INTERVAL;
     this._ssthresh = IKCP_THRESH_INIT;
     //this._deadLink = IKCP_DEADLINK;
     this._buffer   = _bufferAlloc(( int )((this._mtu + IKCP_OVERHEAD) * 3));
     this._output   = output;
     this._writelog = writelog;
 }
Example #23
0
        public void Job()
        {
            LoggerHandler.Init(new[] { (Action <string>)Console.WriteLine }, "" /*GetAvailableLogFilename(logFilePath)*/,
                               minLogLevel: LogLevel.Warn);
            _chat = new ChatClient(settings.TcpServerIp, 10240, "raspberry", "parola01");
            _piHW = new RaspberryHardware(settings.PwmPeriod, settings.PwmHighDuration, settings.LinesToSkip);

            BindEvents();

            _chat.Connect();
            _piHW.Start();

            _working = true;
            while (_working)
            {
                Console.Write("&:");
                var line = Console.ReadLine();
                ProcessCommand(line);
            }
        }
Example #24
0
        private void ProcessCommand(string cmd)
        {
            switch (cmd.ToLower())
            {
            case "exit":
                _chat.Disconnect();
                _piHW.Stop();
                LoggerHandler.Destroy();
                _working = false;
                break;

            case "stop":
                _piHW.Stop();
                break;

            case "start":
                _piHW.Start();
                break;

            case "startpwm":
            case "s":
                _piHW.StartPWM();
                break;

            case "":
                break;

            default:
                if (cmd.ToLower().StartsWith("setnroflines"))
                {
                    var linesToSkip = int.Parse(cmd.Split(' ')[1]);
                    _piHW.SetVariables(_period, _highDuration, linesToSkip);
                    settings.LinesToSkip = linesToSkip;
                    SaveSettings();
                    Console.WriteLine("Set number of lines to skip to " + linesToSkip);
                    break;
                }
                Console.WriteLine("Invalid command: '" + cmd + "'");
                break;
            }
        }
Example #25
0
        static void Main(string[] args)
        {
            LoggerHandler.Init(new[] { (Action <string>)Console.WriteLine }, "" /*GetAvailableLogFilename(logFilePath)*/,
                               minLogLevel: LogLevel.Warn);
            CheckAndCopyKinectFusionSDKLibrary();
            //new Object3D().IgnoreLowerPoints(@"D:\Projects\OC\test\MeshedReconstruction.ply");
            //return;

            bool a = true;

            if (a)
            {
                kinect = new Kinect();
                kinect.Start();
                Console.WriteLine("kinect started");
                Loop();
            }
            else
            {
                KinectLibrary.Program1.Main(null);
            }
        }
Example #26
0
        public void WriteLog()
        {
            var app = new ApplicationContext();

            var clr = this.GetCLR();

            var handler = new LoggerHandler
                          (
                "File",
                new TextFileLogger
            {
                FilePath = "logs/${binding:timestamp#yyyyMM}/${binding:source}[{sequence}].log"
            },
                new LoggerHandlerPredication()
            {
                MinLevel = LogLevel.Info
            }
                          );

            Logger.Handlers.Add(handler);

            Logger.Info("Hello Word!");
        }
Example #27
0
 protected void SendLogMessage(string msg)
 {
     LoggerHandler?.Invoke(this, msg);
 }
Example #28
0
 public void OnLogRecieved(ProgressChangedEventArgs e)
 {
     LoggerHandler?.Invoke(this, e);
 }
Example #29
0
 public void PrintMessage()
 {
     //Logger.GetLogger().Log("weqe");
     //Logger.GetLogger().Close();
     LoggerHandler.WriteToLog("!!!!");
 }
Example #30
0
 private static void HandleLog(string logString, string stackTrace, LogType type)
 {
     LoggerHandler.WriteLog(logString, stackTrace, type);
 }