Beispiel #1
0
        private void LogApiEvent(object sender, Xgminer.Api.LogEventArgs eventArgs)
        {
            ApiLogEntry logEntry = new ApiLogEntry();

            logEntry.DateTime = eventArgs.DateTime;
            logEntry.Request = eventArgs.Request;
            logEntry.Response = eventArgs.Response;
            Xgminer.Api.ApiContext apiContext = (Xgminer.Api.ApiContext)sender;
            logEntry.CoinName = GetCoinNameForApiContext(apiContext);
            logEntry.Machine = apiContext.IpAddress + ":" + apiContext.Port;

            this.BeginInvoke((Action)(() =>
            {
                //code to update UI
                apiLogEntryBindingSource.Position = apiLogEntryBindingSource.Add(logEntry);
                while (apiLogEntryBindingSource.Count > 1000)
                    apiLogEntryBindingSource.RemoveAt(0);
            }));

            LogApiEventToFile(logEntry);
        }
Beispiel #2
0
 private void LogApiEventToFile(ApiLogEntry logEntry)
 {
     const string logFileName = "ApiLog.json";
     LogObjectToFile(logEntry, logFileName);
 }
Beispiel #3
0
        private void LogApiEvent(object sender, Xgminer.Api.LogEventArgs eventArgs)
        {
            ApiLogEntry logEntry = new ApiLogEntry();

            logEntry.DateTime = eventArgs.DateTime;
            logEntry.Request = eventArgs.Request;
            logEntry.Response = eventArgs.Response;
            logEntry.CoinName = GetCoinNameForApiContext((Xgminer.Api.ApiContext)sender);

            apiLogEntryBindingSource.Position = apiLogEntryBindingSource.Add(logEntry);

            while (apiLogEntryBindingSource.Count > 1000)
                apiLogEntryBindingSource.RemoveAt(0);

            LogApiEventToFile(logEntry);
        }