示例#1
0
        public void Build_Write(EngineState s, LogInfo log)
        {
            if (s.DisableLogger)
            {
                return;
            }

            bool doNotLog = false;

            if (0 < TurnOff.Count)
            {
                if (TurnOff.TryPeek(out doNotLog) == false) // Stack Failure
                {
                    doNotLog = false;
                }
            }

            if (doNotLog == false)
            {
                DB_BuildLog dbCode = new DB_BuildLog()
                {
                    Time     = DateTime.UtcNow,
                    BuildId  = s.BuildId,
                    PluginId = s.PluginId,
                    Depth    = log.Depth,
                    State    = log.State,
                };

                if (log.Command == null)
                {
                    dbCode.Message = log.Message;
                }
                else
                {
                    if (log.Message == string.Empty)
                    {
                        dbCode.Message = log.Command.Type.ToString();
                    }
                    else
                    {
                        dbCode.Message = $"{log.Command.Type} - {log.Message}";
                    }
                    dbCode.RawCode = log.Command.RawCode;
                    dbCode.LineIdx = log.Command.LineIdx;
                }

                if (s.DelayedLogging)
                {
                    BuildLogPool.Add(dbCode);
                }
                else
                {
                    DB.Insert(dbCode);

                    // Fire Event
                    BuildLogUpdated?.Invoke(this, new BuildLogUpdateEventArgs(dbCode));
                }
            }
        }
示例#2
0
        public void Build_Write(EngineState s, string message)
        {
            if (s.DisableLogger)
            {
                return;
            }

            bool doNotLog = false;

            if (0 < TurnOff.Count)
            {
                if (TurnOff.TryPeek(out doNotLog) == false) // Stack Failure
                {
                    doNotLog = false;
                }
            }

            if (doNotLog == false)
            {
                DB_BuildLog dbCode = new DB_BuildLog()
                {
                    Time     = DateTime.UtcNow,
                    BuildId  = s.BuildId,
                    PluginId = s.PluginId,
                    Message  = message,
                };

                if (s.DelayedLogging)
                {
                    BuildLogPool.Add(dbCode);
                }
                else
                {
                    DB.Insert(dbCode);

                    // Fire Event
                    BuildLogUpdated?.Invoke(this, new BuildLogUpdateEventArgs(dbCode));
                }
            }
        }
示例#3
0
        public void Build_Write(long buildId, IEnumerable <LogInfo> logs)
        {
            foreach (LogInfo log in logs)
            {
                DB_BuildLog dbCode = new DB_BuildLog()
                {
                    Time     = DateTime.UtcNow,
                    BuildId  = buildId,
                    PluginId = 0,
                    Depth    = log.Depth,
                    State    = log.State,
                };
                BuildLogPool.Add(dbCode);

                if (log.Command == null)
                {
                    dbCode.Message = log.Message;
                }
                else
                {
                    if (log.Message == string.Empty)
                    {
                        dbCode.Message = log.Command.Type.ToString();
                    }
                    else
                    {
                        dbCode.Message = $"{log.Command.Type} - {log.Message}";
                    }
                    dbCode.RawCode = log.Command.RawCode;
                    dbCode.LineIdx = log.Command.LineIdx;
                }

                DB.Insert(dbCode);

                // Fire Event
                BuildLogUpdated?.Invoke(this, new BuildLogUpdateEventArgs(dbCode));
            }
        }