internal void ReportBatch( LogBatch[] batch ) { Object[] args = new Object[] { Backendless.AppId, Backendless.VersionNum, batch }; AsyncCallback<Object> callback = new AsyncCallback<Object>( result => { }, fault => { } ); Invoker.InvokeAsync<Object>( LOGGING_SERVICE_ALIAS, "batchLog", args, callback ); }
internal void ReportBatch( LogBatch[] logBatchs ) { if (logBatchs.Length == 0) return; List<RequestLog> logs = new List<RequestLog>(); foreach (LogBatch logBatch in logBatchs) { foreach (LogMessage message in logBatch.messages) { RequestLog log = new RequestLog(); log.LogLevel = logBatch.logLevel; log.Logger = logBatch.logger; log.Timestamp = message.timestamp; log.Message = message.message; log.Exception = message.exception; logs.Add(log); } } Invoker.InvokeSync<object>(Invoker.Api.LOGGERSERVICE_PUT, new object[] { logs }); }
private void Flush() { LinkedList <LogBatch> allMessages = new LinkedList <LogBatch>(); foreach (String logger in logBatches.Keys) { Dictionary <String, LinkedList <LogMessage> > logLevels = logBatches[logger]; foreach (String logLevel in logLevels.Keys) { LogBatch logBatch = new LogBatch(); logBatch.logger = logger; logBatch.logLevel = logLevel; logBatch.messages = logLevels[logLevel]; allMessages.AddLast(logBatch); } } logBatches.Clear(); LogBatch[] allMessagesArray = new LogBatch[allMessages.Count]; allMessages.CopyTo(allMessagesArray, 0); Backendless.Logging.ReportBatch(allMessagesArray); }
private void Flush() { LinkedList<LogBatch> allMessages = new LinkedList<LogBatch>(); foreach( String logger in logBatches.Keys ) { Dictionary<String, LinkedList<LogMessage>> logLevels = logBatches[ logger ]; foreach( String logLevel in logLevels.Keys ) { LogBatch logBatch = new LogBatch(); logBatch.logger = logger; logBatch.logLevel = logLevel; logBatch.messages = logLevels[ logLevel ]; allMessages.AddLast( logBatch ); logLevels.Remove( logLevel ); } logBatches.Remove( logger ); } logBatches.Clear(); LogBatch[] allMessagesArray = new LogBatch[ allMessages.Count ]; allMessages.CopyTo( allMessagesArray, 0 ); Backendless.Logging.ReportBatch( allMessagesArray ); }