Example #1
0
 private LogItem(string Description, LogItemType ItemType, string FunctionName)
 {
     _Description  = Description;
     _ItemType     = ItemType;
     _FunctionName = FunctionName;
     _Date         = DateTime.Now;
 }
Example #2
0
        private void WriteToLog(LogItemType lit, string s)
        {
            PluginLogItem pli = new PluginLogItem(lit, s);

            PluginLog.Add(pli);
            OnPluginDebugEvent?.Invoke(this, pli.ToLongLogString());
        }
 public LogItem(DateTime time, String source, LogItemType logType, String message)
 {
     this.Time    = time;
     this.Source  = source;
     this.LogType = logType;
     this.Message = message;
 }
 private void LogMessage(string managedItemId, string msg, LogItemType logType = LogItemType.GeneralInfo)
 {
     ManagedCertificateLog.AppendLog(managedItemId, new ManagedCertificateLogItem
     {
         EventDate   = DateTime.UtcNow,
         LogItemType = LogItemType.GeneralInfo,
         Message     = msg
     }, _loggingLevelSwitch);
 }
Example #5
0
 public LogItem(string module, string version, string eventName, LogItemType eventType, string stackTrace)
 {
     EventDate  = DateTime.Now;
     Module     = module;
     Version    = version;
     Event      = eventName;
     EventType  = eventType;
     StackTrace = stackTrace;
 }
Example #6
0
 public LogItem(
     string message,
     string source,
     string file,
     MessageSeverity messageSeverity,
     LogItemType logItemType)
     : this(message, source, file, null, DateTime.UtcNow, messageSeverity, null, logItemType)
 {
 }
Example #7
0
 private void LogMessage(string managedSiteId, string msg, LogItemType logType = LogItemType.GeneralInfo)
 {
     ManagedSiteLog.AppendLog(managedSiteId, new ManagedSiteLogItem
     {
         EventDate   = DateTime.UtcNow,
         LogItemType = LogItemType.GeneralInfo,
         Message     = msg
     });
 }
Example #8
0
 private void LogMessage(string managedSiteId, List <string> msgs, LogItemType logType = LogItemType.GeneralInfo)
 {
     foreach (var msg in msgs)
     {
         if (msg != null)
         {
             LogMessage(managedSiteId, msg, logType);
         }
     }
 }
Example #9
0
        private static void LogCore(LogItemType type, string category, string message, Exception ex)
        {
            if (null == category)
            {
                category = LogItemCategory.Default;
            }

            Contract.ThrowIfNullOrEmpty(message);
            Log(new LogItem(type, category, message, ex), ex);
        }
Example #10
0
 public LogItem(int?userNo, int?verificationNo, int?accountNo, LogItemType type, string description, DateTime logTime)
 {
     No             = 0;
     UserNo         = userNo;
     VerificationNo = verificationNo;
     AccountNo      = accountNo;
     Type           = type;
     Description    = description;
     LogTime        = logTime;
 }
Example #11
0
 public LogItem(LogItemType type, string message, bool useStopwatch)
 {
     Type    = type;
     Message = message;
     Time    = DateTime.Now;
     if (useStopwatch)
     {
         _stopwatch = Stopwatch.StartNew();
     }
 }
Example #12
0
 public static void LogItemAdd(int userId, LogItemType itemType, string beginProperty, ItemInfo item, string AddItem, int result)
 {
     try
     {
         string text = "";
         if (item != null)
         {
             text = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", new object[]
             {
                 item.StrengthenLevel,
                 item.Attack,
                 item.Defence,
                 item.Agility,
                 item.Luck,
                 item.AttackCompose,
                 item.DefendCompose,
                 item.AgilityCompose,
                 item.LuckCompose
             });
         }
         object[] values = new object[]
         {
             LogMgr._gameType,
             LogMgr._serverId,
             LogMgr._areaId,
             DateTime.Now,
             userId,
             (int)itemType,
             (item == null) ? "" : item.Template.Name,
             (item == null) ? 0 : item.ItemID,
             AddItem,
             beginProperty,
             text,
             result
         };
         DataTable logItem;
         Monitor.Enter(logItem = LogMgr.m_LogItem);
         try
         {
             LogMgr.m_LogItem.Rows.Add(values);
         }
         finally
         {
             Monitor.Exit(logItem);
         }
     }
     catch (Exception arg)
     {
         if (LogMgr.log.IsErrorEnabled)
         {
             LogMgr.log.Error("LogMgr Error:ItemAdd @ " + arg);
         }
     }
 }
Example #13
0
 public LogItem(
     string message,
     string source,
     string file,
     int line,
     MessageSeverity messageSeverity,
     string errorCode,
     LogItemType logItemType)
     : this(message, source, file, line, DateTime.UtcNow, messageSeverity, errorCode, logItemType)
 {
 }
Example #14
0
        public LogEntryReceivedMessage(DateTime dateTime, string message, LogItemType entryType)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                throw new ArgumentNullException(nameof(message));
            }

            DateTime  = dateTime;
            Message   = message;
            EntryType = entryType;
        }
Example #15
0
        public static string TypeToString(LogItemType type)
        {
            switch (type)
            {
            case LogItemType.CannotCreateDirectory:
                return("Cannot Create Directory");

            case LogItemType.CannotCopyFile:
                return("Cannot Copy File");

            case LogItemType.PathTooLong:
                return("Path Too Long");

            case LogItemType.Duplicate:
                return("Duplicate File");

            case LogItemType.NoTag:
                return("No Tag Found");

            case LogItemType.TitleNotFound:
                return("Title Not Found");

            case LogItemType.ArtistNotFound:
                return("Artist Not Found");

            case LogItemType.AlbumNotFound:
                return("Album Not Found");

            case LogItemType.TrackNotFound:
                return("Track Not Found");

            case LogItemType.GenreNotFound:
                return("Genre Not Found");

            case LogItemType.YearNotFound:
                return("Year Not Found");

            case LogItemType.CannotDeleteExistingFile:
                return("Cannot Delete Existing File");

            case LogItemType.CannotDeleteSourceFile:
                return("Cannot Delete Source File");

            case LogItemType.SourcePathTooLong:
                return("Source Path Too Long");

            case LogItemType.CannotDeleteEmptySourceFolder:
                return("Cannot Delete Empty Source Folder");

            default:
                return("");
            }
        }
Example #16
0
        public LogItem(LogItemType logType, string category, string summary, Exception exception)
        {
            Debug.Assert(!String.IsNullOrEmpty(summary));
            Debug.Assert(!String.IsNullOrEmpty(category));

            // Set the basic information
            m_logType  = logType;
            m_message  = !String.IsNullOrEmpty(summary) ? summary : String.Empty;
            m_category = !String.IsNullOrEmpty(category) ? category : String.Empty;

            m_exceptionInfo = CreateExceptionInfo(exception);
        }
Example #17
0
        /// <summary>
        /// Logs the specified text with as specified type to the viewport and any method assigned to the GUI.Logger
        /// </summary>
        /// <param name="textToLog"></param>
        /// <param name="type"></param>
        public static void Log(string textToLog, LogItemType type)
        {
            while (m_ViewPort == null || m_ViewPort.IsHandleCreated == false || m_ViewPort.Visible == false)
            {
                Thread.Sleep(15);
            }
            m_ViewPort.AppendToLog(textToLog, type);

            if (GUI.Logger != null)
            {
                Logger.Invoke(textToLog, type);
            }
        }
        /// <summary>
        /// Inserts an item into the log, thread safe.
        /// </summary>
        private void LogInfo(string text, LogItemType type)
        {
            if (InvokeRequired)
            {
                this.Invoke((MethodInvoker) delegate() { LogInfo(text, type); });
                return;
            }

            logItems.Add(new LogItem()
            {
                Message = text, Type = type, Time = DateTime.Now
            });
            olvLog.SetObjects(logItems);
        }
        void Log(LogItemType logItemType, string message)
        {
            var logItem = new LogItem
            {
                Step    = step,
                Type    = logItemType,
                Message = message
            };

            LogList.Add(logItem);
#if DEBUG
            System.Diagnostics.Debug.WriteLine(logItem);
#endif
        }
Example #20
0
        /// <internalonly/>
        void IStateManager.LoadViewState(object state)
        {
            object[] nodeState = (object[])state;
            if (nodeState != null)
            {
                if (nodeState[0] != null)
                {
                    string logString = (string)nodeState[0];
                    // Process each log entry
                    string[] items = logString.Split(',');
                    for (int i = 0; i < items.Length; i++)
                    {
                        string[]    parts = items[i].Split(':');
                        LogItemType type  = (LogItemType)Int32.Parse(parts[0], CultureInfo.InvariantCulture);
                        int         index = Int32.Parse(parts[1], CultureInfo.InvariantCulture);

                        if (type == LogItemType.Insert)
                        {
                            if (_owner != null && _owner.Owner != null)
                            {
                                AddAt(index, _owner.Owner.CreateNode());
                            }
                            else
                            {
                                AddAt(index, new TreeNode());
                            }
                        }
                        else if (type == LogItemType.Remove)
                        {
                            RemoveAt(index);
                        }
                        else if (type == LogItemType.Clear)
                        {
                            Clear();
                        }
                    }
                }

                for (int i = 0; i < nodeState.Length - 1; i++)
                {
                    if ((nodeState[i + 1] != null) && (this[i] != null))
                    {
                        ((IStateManager)this[i]).LoadViewState(nodeState[i + 1]);
                    }
                }
            }
        }
Example #21
0
        void IStateManager.LoadViewState(object state)
        {
            object[] objArray = (object[])state;
            if (objArray != null)
            {
                if (objArray[0] != null)
                {
                    string[] strArray = ((string)objArray[0]).Split(new char[] { ',' });
                    for (int j = 0; j < strArray.Length; j++)
                    {
                        string[]    strArray2 = strArray[j].Split(new char[] { ':' });
                        LogItemType type      = (LogItemType)int.Parse(strArray2[0], CultureInfo.InvariantCulture);
                        int         index     = int.Parse(strArray2[1], CultureInfo.InvariantCulture);
                        switch (type)
                        {
                        case LogItemType.Remove:
                            this.RemoveAt(index);
                            break;

                        case LogItemType.Clear:
                            this.Clear();
                            break;

                        case LogItemType.Insert:
                            if ((this._owner != null) && (this._owner.Owner != null))
                            {
                                this.AddAt(index, this._owner.Owner.CreateNode());
                            }
                            else
                            {
                                this.AddAt(index, new TreeNode());
                            }
                            break;
                        }
                    }
                }
                for (int i = 0; i < (objArray.Length - 1); i++)
                {
                    if ((objArray[i + 1] != null) && (this[i] != null))
                    {
                        ((IStateManager)this[i]).LoadViewState(objArray[i + 1]);
                    }
                }
            }
        }
Example #22
0
        public void Add(string _module, string _eventName, LogItemType _eventType, Exception ex = null)
        {
            if (!string.IsNullOrEmpty(_module) && !string.IsNullOrEmpty(_eventName))
            {
                var logEvent = new LogItem(_module, Version, _eventName, _eventType, ex?.StackTrace);
                LastItem = logEvent.ToString();
                LogItemList.Add(logEvent);

                _oasEvent.RaiseEvent(OasEventType.NewLogItem, logEvent.ToString());

                Debug.WriteLine("Log event was added : " + logEvent.ToString());

                if (_eventType == LogItemType.Error)
                {
                    FlushLog();
                }
            }
        }
Example #23
0
        /// <summary>
        /// 添加铁匠铺操作:强化、合成、熔炼、镶嵌
        /// </summary>
        /// <param name="logItemInfo"></param>
        public static void LogItemAdd(int userId, LogItemType itemType, string beginProperty, ItemInfo item, string AddItem, int result)
        {
            try
            {
                string endProperty = "";
                if (item != null)
                    endProperty = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", item.StrengthenLevel, item.Attack, item.Defence, item.Agility, item.Luck, item.AttackCompose, item.DefendCompose, item.AgilityCompose, item.LuckCompose);

                object[] info = { _gameType, _serverId, _areaId, DateTime.Now, userId, (int)itemType, item == null ? "" : item.Template.Name, item == null ? 0 : item.ItemID, AddItem, beginProperty, endProperty, result };
                lock (m_LogItem)
                {
                    m_LogItem.Rows.Add(info);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("LogMgr Error:ItemAdd @ " + e);
            }
        }
Example #24
0
        public LogItem(
            string message,
            string source,
            string file,
            int?line,
            DateTime dateTime,
            MessageSeverity messageSeverity,
            string code,
            LogItemType logItemType)
        {
            Guard.ArgumentNotNull(message, nameof(message));

            Message         = message;
            Source          = source;
            File            = file;
            Line            = line;
            DateTime        = dateTime;
            MessageSeverity = messageSeverity;
            Code            = code;
            LogItemType     = logItemType;
        }
Example #25
0
 public LogItem(
     string message,
     string source,
     string file,
     int?line,
     DateTime dateTime,
     MessageSeverity messageSeverity,
     string code,
     LogItemType logItemType)
 {
     Message               = message;
     Source                = source;
     File                  = file;
     Line                  = line;
     DateTime              = dateTime;
     MessageSeverity       = messageSeverity;
     MessageSeverityString = messageSeverity;
     Code                  = code;
     LogItemType           = logItemType;
     LogItemTypeString     = logItemType;
     Category              = "ECMA2Yaml";
 }
Example #26
0
        /// <summary>
        /// Logs the specified text with as specified type to the viewport and any method assigned to the GUI.Logger
        /// </summary>
        /// <param name="textToLog"></param>
        /// <param name="type"></param>
        public static void Log(string textToLog, LogItemType type)
        {
            if (m_threadViewPort == null)
            {
                m_threadViewPort = new Thread(new ThreadStart(DisplayViewPort));
                m_threadViewPort.SetApartmentState(ApartmentState.STA);
                m_threadViewPort.IsBackground = true;
                m_threadViewPort.Name         = "ViewPort";
                m_threadViewPort.Start();
            }

            while (m_ViewPort == null || m_ViewPort.IsHandleCreated == false || m_ViewPort.Visible == false)
            {
                Thread.Sleep(15);
            }
            m_ViewPort.AppendToLog(textToLog, type);

            if (GUI.Logger != null)
            {
                Logger.Invoke(textToLog, type);
            }
        }
Example #27
0
        public static LogItem Log(LogItemType type, string message, bool useStopwatch = false)
        {
            var createLogItem = new Func <LogItem>(() =>
            {
                if (type == LogItemType.Error)
                {
                    _selectLogTab();
                }

                var logItem = new LogItem(type, message, useStopwatch);
                _log.Add(logItem);
                _logView.SelectedIndex = _logView.Items.Count - 1;
                _logView.ScrollIntoView(_logView.SelectedItem);

                return(logItem);
            });

            if (Thread.CurrentThread == Application.Current.Dispatcher.Thread)
            {
                return(createLogItem());
            }
            return(Application.Current.Dispatcher.Invoke(createLogItem, DispatcherPriority.Background));
        }
Example #28
0
        /// <summary>
        /// 添加铁匠铺操作:强化、合成、熔炼、镶嵌
        /// </summary>
        /// <param name="logItemInfo"></param>
        public static void LogItemAdd(int userId, LogItemType itemType, string beginProperty, ItemInfo item, string AddItem, int result)
        {
            try
            {
                string endProperty = "";
                if (item != null)
                {
                    endProperty = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", item.StrengthenLevel, item.Attack, item.Defence, item.Agility, item.Luck, item.AttackCompose, item.DefendCompose, item.AgilityCompose, item.LuckCompose);
                }

                object[] info = { _gameType, _serverId, _areaId, DateTime.Now, userId, (int)itemType, item == null ? "" : item.Template.Name, item == null ? 0 : item.ItemID, AddItem, beginProperty, endProperty, result };
                lock (m_LogItem)
                {
                    m_LogItem.Rows.Add(info);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("LogMgr Error:ItemAdd @ " + e);
                }
            }
        }
Example #29
0
        private static void LogCore(LogItemType type, string category, string message, Exception ex)
        {
            if (null == category)
            {
                category = LogItemCategory.Default;
            }

            Contract.ThrowIfNullOrEmpty(message);
            Log(new LogItem(type, category, message, ex), ex);
        }
Example #30
0
 public LogItem(LogItemType type, string message)
 {
     m_type    = type;
     m_message = message;
 }
Example #31
0
 /// <summary>
 /// Writes a message to the application's log. Currently this is just an in-memory log
 /// used mainly for debugging, but it might be altered to write to a file in the future.
 /// </summary>
 public static void Log(LogItemType type, string message)
 {
     s_log.Add(new LogItem(type, message));
 }
Example #32
0
 public static void Log(LogItemType type, string category, string message, Exception ex)
 {
     LogCore(type, category, message, ex);
 }
Example #33
0
 public LogItem(LogItemType type, string message, params object[] messageparams)
 {
     MessageType = type;
     Message     = string.Format(message, messageparams);
 }
 public LogItem(LogItemType type, int index, bool tracked) {
     _type = type;
     _index = index;
     _tracked = tracked;
 }
        /// <summary>
        /// Inserts an item into the log, thread safe.
        /// </summary>
        private void LogInfo(string text, LogItemType type)
        {
            if (InvokeRequired)
            {
                this.Invoke((MethodInvoker)delegate() { LogInfo(text, type); });
                return;
            }

            logItems.Add(new LogItem() { Message = text, Type = type, Time = DateTime.Now });
            olvLog.SetObjects(logItems);
        }
Example #36
0
        public LogItem(LogItemType logType, string category, string summary, Exception exception)
        {
            Debug.Assert(!String.IsNullOrEmpty(summary));
            Debug.Assert(!String.IsNullOrEmpty(category));

            // Set the basic information
            m_logType = logType;
            m_message = !String.IsNullOrEmpty(summary) ? summary : String.Empty;
            m_category = !String.IsNullOrEmpty(category) ? category : String.Empty;

            m_exceptionInfo = CreateExceptionInfo(exception);
        }