Exemplo n.º 1
0
        public void ProcessLogsByTxHash(UInt256 txHash, Snapshot snapshot)
        {
            List <Log> logs = Singleton.EthHelper.GetTransactionReceiptLogs(txHash);

            for (var i = 0; i < logs.Count; i++)
            {
                Log    l  = logs[i];
                LogKey lk = new LogKey()
                {
                    LogIndex = l.LogIndex, TransactionHash = l.TransactionHash
                };
                if (l.Topics.Length == 0)
                {
                    continue;
                }
                UInt256 eventHash = new UInt256(l.Topics[0]);
                //如果这个通知是需要在意的合约和通知 就再处理一波
                CareEvent ce    = snapshot.CareEvents.TryGet(eventHash);
                UInt160   asset = snapshot.CareAssets.TryGet(l.ContractAddress);
                if (ce != null && asset != null)
                {
                    l.Event = ce.EventStr;
                    snapshot.Logs.Add(lk, l);
                    //如果是transfer通知那就再额外处理一波
                    if (ce.EventStr == "Transfer(address,address,uint256)")
                    {
                        ProcessTransferLog(l);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void AddLog(LogKey key, String source, Int64 resource_plugin, String resource, String uri, UserLogLevel type, Int64 entityid, Int64 identityid, String text, String additionalData)
        {
            logRecords1.data.Add(new String[] { DateTime.Now.ToString("o"), ((Int32)key).ToString(), source, resource_plugin.ToString(), resource, uri, ((Int32)type).ToString(), entityid.ToString(), identityid.ToString(), text, additionalData });

            if (logRecords1.data.Count > 500)
            {
                SaveToSend(resource.ToString() + "log");
            }
        }
Exemplo n.º 3
0
        static public void AddUserLog(SqlConnection connection, LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, String additionalData, Int64 executedByEntityId, SqlTransaction transaction)
        {
            SqlBase st = new SqlBase();

            try
            {
                st.AddUserLog(connection, key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, additionalData, executedByEntityId, transaction);
            }
            finally
            {
                st = null;
            }
        }
Exemplo n.º 4
0
        public virtual void LogLatency(LogKey key, Action operationToTrack)
        {
            Stopwatch stopwatch = new Stopwatch();

            try
            {
                stopwatch.Start();
                operationToTrack();
            }
            finally
            {
                stopwatch.Stop();
                this.logData[key] = stopwatch.ElapsedMilliseconds;
            }
        }
Exemplo n.º 5
0
        public virtual T LogLatency <T>(LogKey key, Func <T> operationToTrack)
        {
            Stopwatch stopwatch = new Stopwatch();
            T         result;

            try
            {
                stopwatch.Start();
                result = operationToTrack();
            }
            finally
            {
                stopwatch.Stop();
                this.logData[key] = stopwatch.ElapsedMilliseconds;
            }
            return(result);
        }
Exemplo n.º 6
0
        public void AddUserLog(LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, String additionalData, Int64 executedByEntityId, SqlTransaction transaction)
        {
            DbParameterCollection par = new DbParameterCollection();

            par.Add("@date", typeof(DateTime)).Value = (date.HasValue ? date.Value : DateTime.Now);
            par.Add("@source", typeof(String), source.Length).Value = source;
            par.Add("@key", typeof(Int32)).Value                = (Int32)key;
            par.Add("@level", typeof(Int32)).Value              = (Int32)level;
            par.Add("@proxy_id", typeof(Int64)).Value           = proxyId;
            par.Add("@enterprise_id", typeof(Int64)).Value      = enterpriseId;
            par.Add("@context_id", typeof(Int64)).Value         = contextId;
            par.Add("@resource_id", typeof(Int64)).Value        = resourceId;
            par.Add("@plugin_id", typeof(Int64)).Value          = pluginId;
            par.Add("@entity_id", typeof(Int64)).Value          = entityId;
            par.Add("@identity_id", typeof(Int64)).Value        = identityId;
            par.Add("@text", typeof(String), text.Length).Value = text;
            par.Add("@additional_data", typeof(String), additionalData.Length).Value = additionalData;
            par.Add("@executed_by_entity_id", typeof(Int64)).Value = executedByEntityId;

            ExecuteNonQuery("insert into logs ([date] ,[source] ,[key] ,[level] ,[proxy_id] ,[enterprise_id] ,[context_id] ,[resource_id] ,[plugin_id] ,[entity_id] ,[identity_id] ,[text] ,[additional_data], [executed_by_entity_id]) values (@date ,@source ,@key ,@level ,@proxy_id ,@enterprise_id ,@context_id ,@resource_id, @plugin_id ,@entity_id ,@identity_id ,@text ,@additional_data, @executed_by_entity_id)", System.Data.CommandType.Text, par, transaction);
        }
Exemplo n.º 7
0
        public void CheckConsistency()
        {
            var assetList       = Package.Assets.Where(item => item.Asset.GetType().GetCustomAttribute <AssetDescriptionAttribute>()?.Referenceable ?? true).ToDictionary(x => x.Location.FullPath);
            var assetViewModels = Assets.ToList();
            var logger          = Session.AssetLog.GetLogger(LogKey.Get("Consistency"));

            foreach (var asset in assetViewModels)
            {
                if (!assetList.ContainsKey(asset.Url))
                {
                    logger.Log(new AssetSerializableLogMessage(asset.Id, asset.Url, LogMessageType.Fatal, $"The asset {asset.Url} is missing or incorrectly indexed in the package. Please report this issue."));
                }
                else
                {
                    assetList.Remove(asset.Url);
                }
            }

            foreach (var asset in assetList.Values)
            {
                logger.Log(new AssetSerializableLogMessage(asset.Id, asset.Location, LogMessageType.Fatal, $"The asset {asset.Location} is incorrectly indexed in the package. Please report this issue."));
            }
        }
Exemplo n.º 8
0
 internal object this[LogKey key]
 {
     get
     {
         if (key == LogKey.GenericInfo)
         {
             return(this.genericInfo.ToString() + ";" + this.detailedLatencyInfo.ToString());
         }
         if (key == LogKey.GenericErrors)
         {
             return(this.errorInfo.ToString());
         }
         if (this.data.Keys.Contains(key))
         {
             return(this.data[key]);
         }
         return(null);
     }
     set
     {
         string text = string.Empty;
         if (value != null)
         {
             text = LogData.EscapeStringForCsvFormat(value.ToString());
         }
         if (key == LogKey.GenericInfo || key == LogKey.GenericErrors)
         {
             throw new InvalidOperationException("Cannot set GenericInfo or ErrorInfo directly. Use 'Append' methods.");
         }
         if (!this.data.ContainsKey(key))
         {
             this.data.Add(key, text);
             return;
         }
         string.Format("Attempting to overwrite logdata for key {0} with {1}.", key, text);
     }
 }
Exemplo n.º 9
0
 public override void LogField(LogKey key, object value)
 {
     this.logData[key] = value;
 }
Exemplo n.º 10
0
 static public void AddUserLog(SqlConnection connection, LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, String additionalData)
 {
     AddUserLog(connection, key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, additionalData, null);
 }
Exemplo n.º 11
0
 public static void Add(this Dictionary <String, String> dict, LogKey key, String value)
 {
     dict.Add(key.ToString(), value);
 }
Exemplo n.º 12
0
 public abstract void LogField(LogKey key, object value);
Exemplo n.º 13
0
 public void AddUserLog(LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text)
 {
     AddUserLog(key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, "", null);
 }
Exemplo n.º 14
0
 public void AddUserLog(LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, String additionalData, SqlTransaction transaction)
 {
     AddUserLog(i_cn, key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, additionalData, transaction);
 }
Exemplo n.º 15
0
 public void AddUserLog(SqlConnection conn, LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, String additionalData, Int64 executedByEntityId, SqlTransaction transaction)
 {
     base.Connection = conn;
     AddUserLog(key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, additionalData, executedByEntityId, transaction);
 }
Exemplo n.º 16
0
 public void AddUserLog(SqlConnection connection, LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, Int64 executedByEntityId)
 {
     AddUserLog(connection, key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, "", executedByEntityId, null);
 }
Exemplo n.º 17
0
 public void AddUserLog(LogKey key, DateTime?date, String source, UserLogLevel level, Int64 proxyId, Int64 enterpriseId, Int64 contextId, Int64 resourceId, Int64 pluginId, Int64 entityId, Int64 identityId, String text, String additionalData, Int64 executedByEntityId)
 {
     AddUserLog(key, date, source, level, proxyId, enterpriseId, contextId, resourceId, pluginId, entityId, identityId, text, additionalData, executedByEntityId, null);
 }
Exemplo n.º 18
0
 public virtual void LogElapsedTimeInMilliseconds(LogKey key)
 {
     this.logData[key] = this.logData.GetElapsedTime();
 }
Exemplo n.º 19
0
        public void pageInit()
        {
            DataTable eventList = LogSetting.GetEventList();

            this.cbselLog_changeonly   = false;
            this.cbselEmail_changeonly = false;
            this.dataGridViewEvent.Rows.Clear();
            bool flag  = true;
            bool flag2 = true;
            int  num   = 0;

            this.indexFTSE = -1;
            foreach (DataRow dataRow in eventList.Rows)
            {
                string text = (string)dataRow["eventid"];
                if (!LogKey.isISGEvent(text) || EcoGlobalVar.gl_supportISG)
                {
                    string text2 = LogKey.strSeverity(text);
                    string text3 = LogKey.strCategory(text);
                    string text4 = LogKey.strEvent(text);
                    bool   flag3 = false;
                    bool   flag4 = false;
                    int    num2  = System.Convert.ToInt32(dataRow["logflag"]);
                    if (num2 == 1)
                    {
                        flag3 = true;
                    }
                    else
                    {
                        flag = false;
                    }
                    if (!text.Equals("0120062"))
                    {
                        num2 = System.Convert.ToInt32(dataRow["mailflag"]);
                        if (num2 == 1)
                        {
                            flag4 = true;
                        }
                        else
                        {
                            flag2 = false;
                        }
                    }
                    else
                    {
                        this.indexFTSE = num;
                    }
                    this.dataGridViewEvent.Rows.Add(new object[]
                    {
                        num + 1,
                        flag3,
                        flag4,
                        text3,
                        text2,
                        text4,
                        text
                    });
                    num++;
                }
            }
            if (this.indexFTSE >= 0)
            {
                this.dataGridViewEvent.Rows[this.indexFTSE].Cells[2].ReadOnly = true;
            }
            if (flag)
            {
                if (!this.cbselLog.Checked)
                {
                    this.cbselLog_changeonly = true;
                    this.cbselLog.Checked    = true;
                }
            }
            else
            {
                if (this.cbselLog.Checked)
                {
                    this.cbselLog_changeonly = true;
                    this.cbselLog.Checked    = false;
                }
            }
            if (flag2)
            {
                if (!this.cbselEmail.Checked)
                {
                    this.cbselEmail_changeonly = true;
                    this.cbselEmail.Checked    = true;
                    return;
                }
            }
            else
            {
                if (this.cbselEmail.Checked)
                {
                    this.cbselEmail_changeonly = true;
                    this.cbselEmail.Checked    = false;
                }
            }
        }
 public override void LogElapsedTimeInMilliseconds(LogKey key)
 {
 }
Exemplo n.º 21
0
 public override void LogField(LogKey key, object value)
 {
 }
 public override T LogLatency <T>(LogKey key, Func <T> operationToTrack)
 {
     return(operationToTrack());
 }
 public override void LogLatency(LogKey key, Action operationToTrack)
 {
     operationToTrack();
 }