Beispiel #1
0
        private void UploadEvents(LoggingEvent[] events, AmazonS3 client)
        {
            var key = Filename(Guid.NewGuid().ToString());

            var content = new StringBuilder(events.Count());
            Array.ForEach(events, logEvent =>
                {
                    using (var writer = new StringWriter())
                    {
                        Layout.Format(writer, logEvent);
                        content.AppendLine(writer.ToString());
                    }
                });

            var request = new PutObjectRequest();
            request.WithBucketName(_bucketName);
            request.WithKey(key);
            request.WithContentBody(content.ToString());
            client.PutObject(request);
        }