/// <inheritdoc />
        protected internal override void StartSection(LogSection newSection)
        {
            Trace.CorrelationManager.StartLogicalOperation(newSection.Text);

            Trace.IndentLevel = Target.Context.Count;
            Trace.WriteLine(newSection.Text);
        }
Beispiel #2
0
    public void Logger(Vector3 lookAtPoint)
    {
        if (recorderState == RecorderState.recording)
        {
            if (previousState == StateEnum.InAir && state == StateEnum.OnGround)
            {
                //filled log section inserted into session, and skip if just started recording
                if (logSection != null)
                {
                    sessionLog.logSections.Add(logSection);
                }

                //clear old data for new ones
                logSection        = new LogSection();
                logSection.sector = GetSector();
            }

            LogLine logLine = new LogLine();

            logLine.time           = Time.time;
            logLine.state          = state;
            logLine.action         = action;
            logLine.playerPosition = Point3.ToPoint(player.position);
            logLine.cameraRotation = Rotation4.ToRotation(playerCamera.rotation);
            logLine.lookAtPoint    = Point3.ToPoint(lookAtPoint);

            logSection.logLines.Add(logLine);

            previousState = state;
        }
    }
Beispiel #3
0
        public static Logger GetLogger()
        {
            LogSection group = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).GetSection(LOG_SECTION) as LogSection;

            Enum.TryParse(group.Level.MinLevel, out LoggerLevels level);
            Enum.TryParse(group.Target.LoggerType, out LoggerTypes type);

            if (level == 0)
            {
                level = LoggerLevels.Info;
            }

            if (type == 0)
            {
                type = LoggerTypes.Console;
            }

            switch (type)
            {
            case LoggerTypes.File:
                return(new FileLogger(level, group.Target.FileName));

            case LoggerTypes.Console:
                return(new ConsoleLogger(level));

            case LoggerTypes.Database:
                return(new DatabaseLogger(level));

            default:
                return(new ConsoleLogger(level));
            }
        }
Beispiel #4
0
 private LogListModel getLogList(LogSection section, LogSeverity severity)
 {
     return(SystemService.FindLogListModel(0, 1, 100000, "",
                                           (int)section,
                                           (int)severity,
                                           null,
                                           null));
 }
        /// <inheritdoc />
        protected internal override void FinishSection(LogSection section)
        {
            Trace.IndentLevel = Target.Context.Count;

            if (Trace.CorrelationManager.LogicalOperationStack.Count != 0)
            {
                Trace.CorrelationManager.StopLogicalOperation();
            }
        }
Beispiel #6
0
 public static string LogSectionToString(LogSection logSection)
 {
     return(logSection switch
     {
         LogSection.Wnmp => "Wnmp",
         LogSection.Nginx => "Nginx",
         LogSection.MariaDB => "MariaDB",
         LogSection.PHP => "PHP",
         _ => String.Empty,
     });
        public void TearDown()
        {
            _CurrentPlayerTurn = null;
            foreach (LogSection ls in spArea.Children.OfType <LogSection>())
            {
                ls.TearDown();
            }

            this.PlayerBrushes.Clear();
            spArea.Children.Clear();
        }
Beispiel #8
0
        LogResult getLogCount(LogSection section, LogSeverity severity)
        {
            LogListModel logList = getLogList(section, severity);
            LogResult    res     = new LogResult();

            res.Section  = section;
            res.Severity = severity;
            res.Count    = logList.Items.Count;

            return(res);
        }
Beispiel #9
0
 internal static void Initialize(LogSection section)
 {
     _providers = new LogProviderCollection();
     _provider  = ProviderUtil.InstantiateProviders <LogProvider, LogProviderCollection>(
         section.Providers, section.DefaultProvider, _providers);
     if (_provider == null)
     {
         throw new ConfigurationErrorsException(
                   SR.ConfigDefaultLogProviderNotFound,
                   section.ElementInformation.Properties["defaultProvider"].Source,
                   section.ElementInformation.Properties["defaultProvider"].LineNumber);
     }
 }
Beispiel #10
0
        private static void wnmp_log(string message, Color color, LogSection logSection)
        {
            var str        = string.Format("{0} [{1}] - {2}", DateTime.Now.ToString(), GetEnumDescription(logSection), message);
            var textLength = rtfLog.TextLength;

            rtfLog.AppendText(str + "\n");
            if (rtfLog.Find(GetEnumDescription(logSection), textLength, RichTextBoxFinds.MatchCase) != -1)
            {
                rtfLog.SelectionLength = GetEnumDescription(logSection).Length;
                rtfLog.SelectionColor  = color;
            }

            rtfLog.ScrollToCaret();
        }
Beispiel #11
0
        static Log()
        {
            LogSection logSection = ConfigurationManager.GetSection("log") as LogSection;

            switch (logSection.Target)
            {
            case LogTarget.CONSOLE:
                _specificLog = new ConsoleLog();
                break;

            case LogTarget.FILE:
                _specificLog = new FileLog(logSection.File);
                break;
            }
        }
Beispiel #12
0
    public void Add(Point3 key, LogSection value)
    {
        TableCell cell = table.Find(o => o.key.Equals(key));

        if (cell != null)
        {
            cell.values.Add(value);
        }
        else
        {
            List <LogSection> values = new List <LogSection>();
            values.Add(value);

            table.Add(new TableCell(key, values));
        }
    }
Beispiel #13
0
        private static void wnmp_log(string message, SolidColorBrush brush, LogSection logSection)
        {
            var SectionName = LogSectionToString(logSection);
            var DateNow     = DateTime.Now.ToString();
            Run run1        = new Run(DateNow + " [");
            Run run2        = new Run()
            {
                Text = SectionName, Foreground = brush
            };
            Run run3 = new Run("] - " + message);
            var p    = new Paragraph();

            p.Inlines.AddRange(new Run[] { run1, run2, run3 });
            rtfLog.Document.Blocks.Add(p);
            rtfLog.ScrollToEnd();
        }
        public void NewTurn(DominionBase.Players.Player player, DominionBase.Cards.Card grantedBy)
        {
            Utilities.Log(this.LogFile, "-------------------------------------------------------");

            if (_CurrentPlayerTurn != null)
            {
                _CurrentPlayerTurn.End();
            }

            _CurrentPlayerTurn         = new ucPlayerTurn();
            _CurrentPlayerTurn.LogFile = this.LogFile;
            if (player != null)
            {
                _CurrentPlayerTurn.New(player, this.PlayerBrushes[player.Name], grantedBy);
            }

            if (_CurrentGameTurn != null)
            {
                (_CurrentGameTurn as ucGameTurn).Add(_CurrentPlayerTurn as ucPlayerTurn);

                if (wMain.Settings.AutoCollapseOldTurns)
                {
                    IEnumerable <ucGameTurn> gameTurns = spArea.Children.OfType <ucGameTurn>();
                    if (gameTurns.Count() > 1)
                    {
                        ucGameTurn gtOld = gameTurns.ElementAt(gameTurns.Count() - 2);
                        foreach (ucPlayerTurn pt in gtOld.GetChildren(player))
                        {
                            pt.IsExpanded = false;
                        }
                        if (!gtOld.IsAnyExpanded)
                        {
                            gtOld.IsAllExpanded = true;
                            gtOld.IsExpanded    = false;
                        }
                    }
                }
            }
            else
            {
                spArea.Children.Add(_CurrentPlayerTurn);
            }

            svArea.ScrollToBottom();
            svArea.ScrollToLeftEnd();
        }
        public void NewSection(String title)
        {
            Utilities.Log(this.LogFile, "-------------------------------------------------------");

            if (_CurrentPlayerTurn != null)
            {
                _CurrentPlayerTurn.End();
            }

            _CurrentPlayerTurn         = new ucGameMessage();
            _CurrentPlayerTurn.LogFile = this.LogFile;
            _CurrentPlayerTurn.New(title);

            spArea.Children.Add(_CurrentPlayerTurn);
            svArea.ScrollToBottom();
            svArea.ScrollToLeftEnd();
        }
Beispiel #16
0
        private static void OgnmpLog(string message, Color color, LogSection logSection)
        {
            var sectionName = LogSectionToString(logSection);
            var dateNow     = DateTime.Now.ToString(CultureInfo.CurrentCulture);
            var str         = $"{dateNow} [{sectionName}] - {message}\n";
            var textLength  = _rtfLog.TextLength;

            _rtfLog.AppendText(str);
            if (_rtfLog.Find(sectionName, textLength, RichTextBoxFinds.MatchCase) != -1)
            {
                _rtfLog.SelectionLength = sectionName.Length;
                _rtfLog.SelectionColor  = color;
            }

            _rtfLog.ScrollToCaret();
            _rtfLog.SelectionLength = 0;
        }
Beispiel #17
0
        private static void wnmp_log(string message, Color color, LogSection logSection)
        {
            var SectionName = LogSectionToString(logSection);
            var DateNow     = DateTime.Now.ToString();
            var str         = $"{DateNow} [{SectionName}] - {message}";
            var textLength  = rtfLog.TextLength;

            rtfLog.AppendText(str + "\n");
            if (rtfLog.Find(SectionName, textLength, RichTextBoxFinds.MatchCase) != -1)
            {
                rtfLog.SelectionLength = SectionName.Length;
                rtfLog.SelectionColor  = color;
            }

            rtfLog.ScrollToCaret();
            rtfLog.SelectionStart = rtfLog.TextLength; // Deselect text
        }
Beispiel #18
0
        private static void WnmpLog(string message, Color color, LogSection logSection)
        {
            string SectionName = LogSectionToString(logSection);
            string DateNow     = DateTime.Now.ToString();
            string str         = $"{DateNow} [{SectionName}] - {message}\n";
            int    textLength  = rtfLog.TextLength;

            rtfLog.AppendText(str);
            if (rtfLog.Find(SectionName, textLength, RichTextBoxFinds.MatchCase) != -1)
            {
                rtfLog.SelectionLength = SectionName.Length;
                rtfLog.SelectionColor  = color;
            }

            rtfLog.ScrollToCaret();
            rtfLog.SelectionLength = 0;
        }
Beispiel #19
0
        public static string LogSectionToString(LogSection logSection)
        {
            switch (logSection)
            {
            case LogSection.WNMP_MAIN:
                return("Wnmp Main");

            case LogSection.WNMP_APACHE:
                return("Wnmp Apache");

            case LogSection.WNMP_MARIADB:
                return("Wnmp Mysql");

            default:
                return("");
            }
        }
        private void _QueuePoolHelper_SendMessage(object sender, QueuePoolEventArgs <OperationLogInfo> e)
        {
            OperationLogInfo message = e.Message;

            try
            {
                LogSection logSection = LogSectionHelper.GetLogSection();
                if (!string.IsNullOrWhiteSpace(logSection.Application))
                {
                    LogRule           rule             = new LogRule();
                    loger_application cacheApplication = rule.GetCacheApplication(logSection.Application);
                    if (cacheApplication != null)
                    {
                        loger_operationloging _operationloging = new loger_operationloging {
                            ApplicationID   = cacheApplication.ApplicationID,
                            ApplicationName = cacheApplication.ApplicationName,
                            Account         = message.UserAccount,
                            TableName       = message.TableName,
                            OperationTypeID = (int)message.OperationType,
                            SqlQuery        = message.SqlQuery,
                            CreateDate      = message.CreateDate,
                            IDPath          = cacheApplication.IDPath,
                            ModuleTypeCode  = message.LogModuleTypeCode,
                            ApplicationHost = LogSectionHelper.Host,
                            UserHostAddress = message.UserHostAddress,
                            UrlReferrer     = message.UrlReferrer,
                            RawUrl          = message.RawUrl
                        };
                        rule.CurrentEntities.AddTologer_operationloging(_operationloging);
                        rule.SaveChanges();
                    }
                }
            }
            catch (Exception exception)
            {
                try
                {
                    LogHelper <LogModuleType> .Write(LogModuleType.LogManager, "记录操作日志出现异常", exception, "");
                }
                catch (Exception exception2)
                {
                    EventLogWriter.WriterLog(exception2);
                }
            }
        }
        public void NewTurn(int turnNumber)
        {
            Utilities.Log(this.LogFile, String.Format("=======================================================", turnNumber));
            Utilities.Log(this.LogFile, String.Format("---------------------- Turn #{0} {1}---------------------", turnNumber, (new StringBuilder()).Insert(0, "-", 3 - (int)Math.Log10(turnNumber))));

            if (_CurrentGameTurn != null)
            {
                _CurrentGameTurn.End();
            }

            _CurrentGameTurn         = new ucGameTurn();
            _CurrentGameTurn.LogFile = this.LogFile;
            (_CurrentGameTurn as ucGameTurn).New(turnNumber);

            spArea.Children.Add(_CurrentGameTurn);
            svArea.ScrollToBottom();
            svArea.ScrollToLeftEnd();
        }
Beispiel #22
0
    //Stops invoking logger method, saves session log and resets some variables
    public void Stop()
    {
        Debug.Log("Recording Ended");

        CancelInvoke();
        isRecording = false;

        sessionLog.logSections.Add(logSection);
        sessionLog.sessionEnd = DateTime.Now.ToString("dd-MM-yy-HH-mm-ss");

        string json = JsonUtility.ToJson(sessionLog, true);

        File.WriteAllText(Application.dataPath + "/Resources/Logs/session_log_" + sessionLog.sessionStart + ".json", json);

        //clean
        currentState  = StateEnum.OnGround;
        previousState = StateEnum.InAir;
        logSection    = new LogSection();
    }
        public void Clear()
        {
            _CurrentPlayerTurn = null;
            foreach (LogSection ls in spArea.Children.OfType <LogSection>())
            {
                ls.Dispose();
            }

            this.PlayerBrushes.Clear();
            spArea.Children.Clear();
            svArea.ScrollToTop();
            if (System.IO.File.Exists(this.LogFile))
            {
                Utilities.LogClear(this.LogFile);
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
        }
Beispiel #24
0
 public static void ProcessNoUserAgentBeginRequest()
 {
     try
     {
         if (((SysVariable.CurrentContext != null) && (SysVariable.CurrentContext.Request != null)) && (SysVariable.CurrentContext.Request.UserAgent == null))
         {
             HttpResponse response   = SysVariable.CurrentContext.Response;
             LogSection   logSection = LogSectionHelper.GetLogSection();
             response.ContentType = "text/plain";
             response.Write(logSection.Error.ErrorHint);
             HttpContext.Current.ApplicationInstance.CompleteRequest();
             Write("Application", LogCategory.AttackInfo, "NoUserAgentBeginRequest抓取处理", "NoUserAgentBeginRequest抓取处理", "");
         }
     }
     catch (Exception exception)
     {
         Write("Application", "Application_Error", exception, "");
     }
 }
Beispiel #25
0
        public static string LogSectionToString(LogSection logSection)
        {
            switch (logSection)
            {
            case LogSection.WNMP_MAIN:
                return("Wnmp Main");

            case LogSection.WNMP_NGINX:
                return("Wnmp Nginx");

            case LogSection.WNMP_MARIADB:
                return("Wnmp Mysql");

            case LogSection.WNMP_PHP:
                return("Wnmp PHP");

            default:
                return("");
            }
        }
Beispiel #26
0
        public static string LogSectionToString(LogSection logSection)
        {
            switch (logSection)
            {
            case LogSection.Ognmp:
                return("Ognmp");

            case LogSection.Nginx:
                return("Nginx");

            case LogSection.MariaDb:
                return("MariaDB");

            case LogSection.Php:
                return("PHP");

            default:
                return("");
            }
        }
Beispiel #27
0
    //logger method logs are grouped in log sections and all the body parts of the player is captured
    public void Logger(Vector3 targetPoint)
    {
        if (isRecording)
        {
            if (previousState == StateEnum.InAir && currentState == StateEnum.OnGround)
            {
                if (logSection != null)
                {
                    sessionLog.logSections.Add(logSection);
                }

                logSection        = new LogSection();
                logSection.sector = Point3.DivideRound(AgentManager.instance.playerHead.position - AgentManager.instance.boundingBoxPivot, unitSize) - Point3.one;
            }

            LogLine logLine = new LogLine();

            logLine.time   = Time.time;
            logLine.state  = currentState;
            logLine.action = currentAction;

            logLine.playerPosition = Point3.ToPoint(AgentManager.instance.player.position);

            logLine.cameraPosition = logLine.playerPosition - Point3.ToPoint(AgentManager.instance.playerHead.position);
            logLine.cameraRotation = Point3.ToPoint(AgentManager.instance.playerHead.rotation.eulerAngles);

            logLine.leftHandPosition = logLine.playerPosition - Point3.ToPoint(AgentManager.instance.leftHand.position);
            logLine.leftHandRotation = Point3.ToPoint(AgentManager.instance.leftHand.rotation.eulerAngles);

            logLine.rightHandPosition = logLine.playerPosition - Point3.ToPoint(AgentManager.instance.rightHand.position);
            logLine.rightHandRotation = Point3.ToPoint(AgentManager.instance.rightHand.rotation.eulerAngles);

            logLine.targetPoint = Point3.ToPoint(targetPoint);

            logSection.logLines.Add(logLine);

            previousState = currentState;
        }
    }
 public void WriteLog(string message, LogSeverity severity = LogSeverity.Normal, LogSection logSection = LogSection.SystemError)
 {
     Console.WriteLine(message);
     db.WriteLog(logSection, severity, message);
 }
Beispiel #29
0
        private static void wnmp_log(string message, Color color, LogSection logSection)
        {
            var str = string.Format("{0} [{1}] - {2}", DateTime.Now.ToString(), GetEnumDescription(logSection), message);
            var textLength = rtfLog.TextLength;
            rtfLog.AppendText(str + "\n");
            if (rtfLog.Find(GetEnumDescription(logSection), textLength, RichTextBoxFinds.MatchCase) != -1) {
                rtfLog.SelectionLength = GetEnumDescription(logSection).Length;
                rtfLog.SelectionColor = color;
            }

            rtfLog.ScrollToCaret();
        }
Beispiel #30
0
 /// <summary>
 /// Log error
 /// </summary>
 public static void wnmp_log_error(string message, LogSection logSection)
 {
     wnmp_log(message, Color.Red, logSection);
 }
Beispiel #31
0
 /// <summary>
 /// Log information
 /// </summary>
 public static void wnmp_log_notice(string message, LogSection logSection)
 {
     wnmp_log(message, Color.DarkBlue, logSection);
 }
Beispiel #32
0
 /// <summary>
 /// Log error
 /// </summary>
 public static void wnmp_log_error(string message, LogSection logSection)
 {
     wnmp_log(message, Color.Red, logSection);
 }
Beispiel #33
0
 /// <summary>
 /// Log information
 /// </summary>
 public static void wnmp_log_notice(string message, LogSection logSection)
 {
     wnmp_log(message, Color.DarkBlue, logSection);
 }