Exemplo n.º 1
0
        public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit)
        {
            if (!Main.EventMgr.PluginExists<Events.System>())
            {
                this.Log.LogLine("Task \"LogSystemEvents\" is missing EventPlugin \"System\"!", Log.Type.Error);
                return false;
            }

            this.Main = Main;
            this.Log = Main.Log;

            swInit.Stop();
            Events.System sysEvents = Main.EventMgr.GetPlugin<Events.System>();
            swInit.Start();

            sysEvents.InstalledFontsChanged += new Events.EventPlugin.Event(sysEvents_InstalledFontsChanged);
            sysEvents.FontAdded += new Events.EventPlugin.EventValue<FontFamily>(sysEvents_FontAdded);
            sysEvents.FontRemoved += new Events.EventPlugin.EventValue<FontFamily>(sysEvents_FontRemoved);

            sysEvents.Logoff += new Events.EventPlugin.Event(sysEvents_Logoff);
            sysEvents.Shutdown += new Events.EventPlugin.Event(sysEvents_Shutdown);

            sysEvents.ConsoleConnect += new Events.EventPlugin.Event(sysEvents_ConsoleConnect);
            sysEvents.ConsoleDisconnect += new Events.EventPlugin.Event(sysEvents_ConsoleDisconnect);
            sysEvents.RemoteConnect += new Events.EventPlugin.Event(sysEvents_RemoteConnect);
            sysEvents.RemoteDisconnect += new Events.EventPlugin.Event(sysEvents_RemoteDisconnect);
            sysEvents.SessionLock += new Events.EventPlugin.Event(sysEvents_SessionLock);
            sysEvents.SessionLogoff += new Events.EventPlugin.Event(sysEvents_SessionLogoff);
            sysEvents.SessionLogon += new Events.EventPlugin.Event(sysEvents_SessionLogon);
            sysEvents.SessionRemoteControl += new Events.EventPlugin.Event(sysEvents_SessionRemoteControl);
            sysEvents.SessionUnlock += new Events.EventPlugin.Event(sysEvents_SessionUnlock);

            return true;
        }
        /// <summary>
        /// 检查用户是否有该Action执行的操作权限
        /// </summary>
        /// <param name="actionContext"></param>
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            //增加操作日志
            var log = new Log()
            {
                Action = $"{actionContext.ControllerContext.ControllerDescriptor.ControllerName}/{actionContext.ActionDescriptor.ActionName}",
                Note = GetText(actionContext.ActionArguments)
            };

            var b = actionContext.Request.Headers.Referrer;
            var attr = actionContext.ActionDescriptor.GetCustomAttributes<AllowAnonymousAttribute>();
            if (attr.Any(a => a != null))//判断是否允许匿名调用
            {
                base.OnActionExecuting(actionContext);
            }
            else if (b != null && CfgLoader.Instance.GetArraryConfig<string>("Csrf", "Address").Any(r => b.ToString().StartsWith(r)))
            {
                AuthFrom(actionContext, ref log);
            }
            else if (b == null)
            {
                actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
            }

            base.OnActionExecuting(actionContext);

            log.Save(Guid.Empty);
        }
Exemplo n.º 3
0
        public void WriteLineTest()
        {
            var logFilename = Path.Combine(_logFileDirectory, "logtest.txt");
              using (var sw = new StreamWriter(logFilename))
              {
            var log = new Log(sw);
            log.WriteLine(LogEntryType.Info, "info log entry");
            log.WriteLine(LogEntryType.Warning, "warning log entry");
            log.WriteLine(LogEntryType.Error, "error log entry");
              }

              var logFileContents = File.ReadAllLines(logFilename);

              /*
            Log entries look like this:

              2013-01-26T02:00:26.3637578Z - INF - Hello, world!
              2013-01-26T02:00:26.3793828Z - WRN - Hello, world!
              2013-01-26T02:00:26.3793828Z - ERR - Hello, world!
              */

              Assert.IsTrue(this.DoesMatchLogEntryFormat(logFileContents[0], "INF", "info log entry"), logFileContents[0]);
              Assert.IsTrue(this.DoesMatchLogEntryFormat(logFileContents[1], "WRN", "warning log entry"), logFileContents[1]);
              Assert.IsTrue(this.DoesMatchLogEntryFormat(logFileContents[2], "ERR", "error log entry"), logFileContents[2]);
        }
Exemplo n.º 4
0
 public ClientInputProcessor(INetworkPlayerProcessor networkPlayerProcessor, Log<ChatMessage> serverChatLog, IClientStateTracker clientStateTracker, IIncomingMessageQueue incomingMessageQueue)
 {
     this.NetworkPlayerProcessor = networkPlayerProcessor;
     this.ServerChatLog = serverChatLog;
     this.ClientStateTracker = clientStateTracker;
     this.IncomingMessageQueue = incomingMessageQueue;
 }
Exemplo n.º 5
0
        // 로그를 출력합니다.
        public void Logger(Log type, string format, params Object[] args)
        {
            string message = String.Format(format, args);

            switch (type)
            {
                case Log.조회:
                    lst조회.Items.Add(message);
                    lst조회.SelectedIndex = lst조회.Items.Count - 1;
                    break;
                case Log.에러:
                    lst에러.Items.Add(message);
                    lst에러.SelectedIndex = lst에러.Items.Count - 1;
                    break;
                case Log.일반:
                    lst일반.Items.Add(message);
                    lst일반.SelectedIndex = lst일반.Items.Count - 1;
                    break;
                case Log.실시간:
                    lst실시간.Items.Add(message);
                    lst실시간.SelectedIndex = lst실시간.Items.Count - 1;
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 6
0
        public CommandConsole(IMediator mediator, Log<string> commandLog)
        {
            _mediator = mediator;

            Active = false;
            Log = commandLog;
        }
Exemplo n.º 7
0
 public void TestConcurrency()
 {
     // start up the next log instance
      var queue = new Loggers.Queue();
      var props = new List<String>()
      {
     "Request.Duration"
      };
      using (
     Log.RegisterInstance(
        new Instance()
        {
           Logger = queue,
           Synchronous = false,
           Buffer = 0,
           Properties = props
        }
     )
      )
      {
     Log log = new Log(GetType());
     Parallel.For(0, TestParallelIterations,
        i => new MockHttp.Application().DispatchRequest()
     );
     Log.Flush();
     // verify event properties
     for (Int32 i = 0; i < TestParallelIterations; i++)
     {
        var evt = queue.Dequeue().First();
        Assert.IsTrue((Int64)evt["Request.Duration"] > 0);
        Assert.IsTrue((Int64)evt["Request.Duration"] < 10000000);
     }
     Assert.IsFalse(queue.Dequeue().Any());
      }
 }
 public void LoglamaDogruCalisiyorMu()
 {
     LogManager manager = LogManager.CreateInstance(new TestConfigReader("DAI.Log,DAI.Log.TraceLogger", "DAI.Log,DAI.Log.HtmlLogFormatter"));
     Log myLog = new Log("Deneme mesaj", LogPriority.Normal, DateTime.Now);
     bool result = manager.WriteLog(myLog);
     Assert.AreEqual(result, true);
 }
Exemplo n.º 9
0
        public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit)
        {
            if (!Main.EventMgr.PluginExists<Events.Screen>())
            {
                this.Log.LogLine("Task \"LogScreenEvents\" is missing EventPlugin \"Screen\"!", Log.Type.Error);
                return false;
            }

            this.Main = Main;
            this.Log = Main.Log;

            swInit.Stop();
            Events.Screen screenEvents = Main.EventMgr.GetPlugin<Events.Screen>();
            swInit.Start();

            screenEvents.ScreenAdded += new Events.EventPlugin.EventValue<ScreenEx>(screenEvents_ScreenAdded);
            screenEvents.ScreenRemoved += new Events.EventPlugin.EventValue<ScreenEx>(screenEvents_ScreenRemoved);
            screenEvents.ScreenColorDepthChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenColorDepthChanged);
            screenEvents.ScreenResolutionChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenResolutionChanged);
            screenEvents.PrimaryScreenChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_PrimaryScreenChanged);
            screenEvents.ScreenLocationChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenLocationChanged);
            screenEvents.ScreenOrientationChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenOrientationChanged);
            screenEvents.ScreenRefreshRateChanged += new Events.EventPlugin.EventValues<ScreenEx>(screenEvents_ScreenRefreshRateChanged);
            return true;
        }
Exemplo n.º 10
0
        public Log GetLog(int LoggerId)
        {
            Log oLog = new Log();
            DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECTLog",CommandType.StoredProcedure);
            oDbCommand.Parameters.Add(DbProviderHelper.CreateParameter("@LoggerId",DbType.Int32,LoggerId));
            DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
            while (oDbDataReader.Read())
            {
                oLog.LoggerId = Convert.ToInt32(oDbDataReader["LoggerId"]);

                if(oDbDataReader["LoggerGuid"] != DBNull.Value)
                    oLog.LoggerGuid = (Guid) oDbDataReader["LoggerGuid"];

                if(oDbDataReader["UserGuid"] != DBNull.Value)
                    oLog.UserGuid = (Guid) oDbDataReader["UserGuid"];

                if(oDbDataReader["Title"] != DBNull.Value)
                    oLog.Title = Convert.ToString(oDbDataReader["Title"]);
                oLog.SubmissionGuid = (Guid) oDbDataReader["SubmissionGuid"];

                if(oDbDataReader["Message"] != DBNull.Value)
                    oLog.Message = Convert.ToString(oDbDataReader["Message"]);
                oLog.DateCreated = Convert.ToDateTime(oDbDataReader["DateCreated"]);
            }
            oDbDataReader.Close();
            return oLog;
        }
Exemplo n.º 11
0
        public static Log Insert(Log myItem)
        {
            using (MySqlConnection myConnection = new MySqlConnection(Param.MySQLConnectionString))
            {
                StringBuilder mySql = new StringBuilder();
                mySql.Append("INSERT INTO `Log` ");
                mySql.Append("(`idProjet`, `libelle`, ");
                mySql.Append("`cheminFichier`, commentaire )");
                mySql.Append(" VALUES ");
                mySql.Append("(@idProjet, @libelle, ");
                mySql.Append("@cheminFichier, @commentaire );");
                mySql.Append("SELECT LAST_INSERT_ID(); ");
                MySqlCommand myCommand = new MySqlCommand(mySql.ToString(), myConnection);
                myCommand.CommandType = CommandType.Text;
                myCommand.Parameters.AddWithValue("@idProjet", myItem.idProjet);
                myCommand.Parameters.AddWithValue("@libelle", myItem.libelle);
                myCommand.Parameters.AddWithValue("@cheminFichier", myItem.cheminFichier);
                myCommand.Parameters.AddWithValue("@commentaire", myItem.commentaire);
                myConnection.Open();
                myItem.id = iZyMySQL.GetIntFromDBInt(myCommand.ExecuteScalar());
                myConnection.Close();
            }

            return myItem;
        }
Exemplo n.º 12
0
		void log(Log.Severity severity, string str)
		{
			using (Log.pushContext(_name))
			{
				Log.log(severity, str);
			}
		}
Exemplo n.º 13
0
 public void TestMethod1()
 {
     LogDAL dal = new LogDAL();
     Log log = new Log { Thread = "1", Exception = "Test", Description = "test", Time = DateTime.Now };
     int result = dal.Insert(log);
     Console.WriteLine(result);
 }
Exemplo n.º 14
0
        public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit)
        {
            if (!Main.EventMgr.PluginExists<Events.Power>())
            {
                this.Log.LogLine("Task \"LogPowerEvents\" is missing EventPlugin \"Power\"!", Log.Type.Error);
                return false;
            }

            this.Main = Main;
            this.Log = Main.Log;

            swInit.Stop();
            Events.Power pwrEvents = Main.EventMgr.GetPlugin<Events.Power>(new object[] {Main}, true);
            swInit.Start();

            pwrEvents.PowerModeChanged += new Events.EventPlugin.EventValue<PowerModes>(pwrEvents_PowerModeChanged);
            pwrEvents.Suspend += new Events.EventPlugin.Event(pwrEvents_Suspend);
            pwrEvents.Resume += new Events.EventPlugin.Event(pwrEvents_Resume);
            pwrEvents.PowerLineStatusChanged += new Events.EventPlugin.EventValues<PowerLineStatus>(pwrEvents_PowerLineStatusChanged);
            pwrEvents.BatteryAvailabilityChanged += new Events.EventPlugin.EventValue<bool?>(pwrEvents_BatteryAvailabilityChanged);
            pwrEvents.BatteryStatusChanged += new Events.EventPlugin.EventValues<BatteryChargeStatus>(pwrEvents_BatteryStatusChanged);

            pwrEvents.PowerSchemeChanged += new Events.EventPlugin.EventValues<PowerScheme>(pwrEvents_PowerSchemeChanged);
            return true;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Closes the application via the 'File - Exit' menu.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <exception cref="RegressionTestFailedException">
        ///     Thrown if the 'File - Exit' menu could not be invoked for some reason.
        /// </exception>
        public static void CloseApplicationViaFileExitMenuItem(Application application, Log log)
        {
            const string prefix = "Menus - Close application via File menu";
            var menu = GetMainMenu(application, log);
            if (menu == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to get the main menu.");
            }

            var fileMenuSearchCriteria = SearchCriteria.ByAutomationId(MainMenuAutomationIds.File);
            var exitSearchCriteria = SearchCriteria.ByAutomationId(MainMenuAutomationIds.FileExit);
            var exitMenu = Retry.Times(() => menu.MenuItemBy(fileMenuSearchCriteria, exitSearchCriteria));
            if (exitMenu == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to get the 'File - Exit' menu.");
            }

            try
            {
                exitMenu.Click();
                application.Process.WaitForExit(Constants.ShutdownWaitTimeInMilliSeconds());
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to click the 'File - Exit' menu item.", e);
            }
        }
Exemplo n.º 16
0
 public frmLogin()
 {
     InitializeComponent();
     gObjLog = new Log("LOGAR NO SISTEMA");
     gObjLog.FormatoArquivo = FormatoArquivoLog.NOME_DDMMAAAA;
     gObjLog.FormatoDiretorio = FormatoDiretorioLog.MES_ANO ;
 }
 public PowershellAdapterPSHost(Log log)
 {
     this.hostId = Guid.NewGuid();
     this.ui = new PowershellAdapterPSHostUserInterface(log);
     this.currentCulture = Thread.CurrentThread.CurrentCulture;
     this.currentUiCulture = Thread.CurrentThread.CurrentUICulture;
 }
Exemplo n.º 18
0
 public GameStateSender(Log<ChatMessage> chatLog, IClientStateTracker clientStateTracker, ISnapCounter snapCounter, IOutgoingMessageQueue outgoingMessageQueue)
 {
     this.ChatLog = chatLog;
     this.ClientStateTracker = clientStateTracker;
     this.SnapCounter = snapCounter;
     this.OutgoingMessageQueue = outgoingMessageQueue;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     try {
     logId = Utility.GetIntParameter("logId");
     if (logId > 0) {
       SetErrorLogDetailsProperties();
       Log log = new Log(logId);
       lblLogDateDisplay.Text = log.LogDate.ToLongDateString();
       lblLogLevelDisplay.Text = ((Logger.LogMessageType)Convert.ToInt32(log.MessageType.ToString())).ToString();
       lblLogMessageDisplay.Text = log.Message;
       lblLogScriptNameDisplay.Text = log.ScriptName;
       lblAuthenticatedUserDisplay.Text = log.AuthUser;
       lblRemoteHostDisplay.Text = log.RemoteHost;
       lblUserAgentDisplay.Text = log.UserAgent;
       lblReferrerDisplay.Text = log.Referer;
       lblExceptionTypeDisplay.Text = log.ExceptionType;
       lblExceptionMessageDisplay.Text = log.ExceptionMessage;
       lblQueryStringDataDisplay.Text = log.QueryStringData;
       txtLogInfoDisplay.Text = log.ExceptionStackTrace;
     }
       }
       catch (Exception ex) {
     Logger.Error(typeof(errorlogdetails).Name + ".Page_Load", ex);
     Master.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }
Exemplo n.º 20
0
		private void SetConsoleBackColor(Log source)
		{
			if      (source == Log.Core)   Console.BackgroundColor = ConsoleColor.DarkBlue;
			else if (source == Log.Game)   Console.BackgroundColor = ConsoleColor.DarkCyan;
			else if (source == Log.Editor) Console.BackgroundColor = ConsoleColor.DarkMagenta;
			else                           Console.BackgroundColor = ConsoleColor.Black;
		}
Exemplo n.º 21
0
 public void AddLog(int ammount, string action)
 {
     Log dummy = new Log();
     dummy.ammount = ammount;
     dummy.action = action;
     List.Add(dummy);
 }
Exemplo n.º 22
0
 // 로그를 출력합니다.
 public static void PrintF(Log type, string format, params Object[] args)
     {
         string message = String.Format(format, args);
         
         switch (type)
         {
             case Log.조회:
                 message = "[조회]" + message;
                 break;
             case Log.에러:
                 message = "[에러]" + message;
                 break;
             case Log.일반:
                 message = "[일반]" + message;
                 break;
             case Log.실시간:
                 message = "[실시간]" + message;
                 break;
             case Log.디버깅:
                 message = "[디버깅]" + message;
                 break;
             default:
                 break;
         }
         PrintF(message);
     }
Exemplo n.º 23
0
        /// <summary>
        /// Closes the start page tab item via the close button on the tab item.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <exception cref="RegressionTestFailedException">
        ///     Thrown if the tab could not be closed via the close button for some reason.
        /// </exception>
        public static void CloseStartPageTab(Application application, Log log)
        {
            const string prefix = "Tabs - Close start page tab";
            var startPage = GetStartPageTabItem(application, log);
            if (startPage == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to find the start page tab.");
            }

            var closeTabSearchCriteria = SearchCriteria
                .ByAutomationId(WelcomeViewAutomationIds.CloseTabButton)
                .AndControlType(ControlType.Button);
            var closeTabButton = Retry.Times(() => (Button)startPage.Get(closeTabSearchCriteria));
            if (closeTabButton == null)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to find the close start page tab button.");
            }

            try
            {
                closeTabButton.Click();
            }
            catch (Exception e)
            {
                throw new RegressionTestFailedException(prefix + ": Failed to close the project tab.", e);
            }
        }
Exemplo n.º 24
0
        public List<Log> GetLogs()
        {
            List<Log> lstLogs = new List<Log>();
            DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECTLogs",CommandType.StoredProcedure);
            DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
            while (oDbDataReader.Read())
            {
                Log oLog = new Log();
                oLog.LoggerId = Convert.ToInt32(oDbDataReader["LoggerId"]);

                if(oDbDataReader["LoggerGuid"] != DBNull.Value)
                    oLog.LoggerGuid = (Guid) oDbDataReader["LoggerGuid"];

                if(oDbDataReader["UserGuid"] != DBNull.Value)
                    oLog.UserGuid = (Guid) oDbDataReader["UserGuid"];

                if(oDbDataReader["Title"] != DBNull.Value)
                    oLog.Title = Convert.ToString(oDbDataReader["Title"]);
                oLog.SubmissionGuid = (Guid) oDbDataReader["SubmissionGuid"];

                if(oDbDataReader["Message"] != DBNull.Value)
                    oLog.Message = Convert.ToString(oDbDataReader["Message"]);
                oLog.DateCreated = Convert.ToDateTime(oDbDataReader["DateCreated"]);
                lstLogs.Add(oLog);
            }
            oDbDataReader.Close();
            return lstLogs;
        }
Exemplo n.º 25
0
        public void SetUp()
        {
            dispatcher = new TestRunnerEventDispatcher();
            log = new Log();

            var ext = new TeamCityExtension("flow");
            ext.Install(dispatcher, log);
        }
Exemplo n.º 26
0
 public SessionState(Log log, int heartBtInt)
 {
     log_ = log;
     this.HeartBtInt = heartBtInt;
     this.IsInitiator = (0 != heartBtInt);
     lastReceivedTimeDT_ = DateTime.UtcNow;
     lastSentTimeDT_ = DateTime.UtcNow;
 }
 public EventLogsViewModel(Log log)
 {
     this.Id = log.LogId;
     this.Executor = log.Executor;
     this.EventType = log.Event.Name;
     this.Description = log.Description;
     this.Date = log.Date;
 }
Exemplo n.º 28
0
        public void TestMethod1()
        {
            Log log = new Log();
            log.Level = "asdasd";

            Console.WriteLine(log.GetType().Name);
            //Console.ReadKey();
        }
Exemplo n.º 29
0
        public void Test_New()
        {
            var log = new Log ("Node", 1, "Message");

            Assert.AreEqual ("Node", log.Node);
            Assert.AreEqual (1, log.Priority);
            Assert.AreEqual ("Message", log.Message);
        }
Exemplo n.º 30
0
 public Djvi(int playerCount, Log log)
 {
     ayvis = new Ayvi[playerCount];
     for (int i = 0; i < ayvis.Length; ++i)
         ayvis[i] = new Ayvi();
     Log = log;
     ctoken = new CancellationTokenSource();
 }