From 60bf54a4119f3f95891c0526b1caaaa45cbf8b44 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Wed, 31 Jan 2018 01:03:13 +0100
Subject: [PATCH] Example of a wrapper method using string formatting
 parameters.

This can probably safely be removed once the logging has stabilized and
is tested in production.

Refers to #3
---
 AutoTx/Email.cs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/AutoTx/Email.cs b/AutoTx/Email.cs
index 554a5fd..d678364 100644
--- a/AutoTx/Email.cs
+++ b/AutoTx/Email.cs
@@ -71,6 +71,18 @@ namespace AutoTx
             return text;
         }
 
+        /// <summary>
+        /// Wrapper method to send an email and log a message using a format string.
+        /// 
+        /// TODO: Once logging has stabilized we can probably safely remove this method again!
+        /// </summary>
+        public void AdminDebugLog(string subject, string format, params object[] list) {
+            var msg = string.Format(format, list);
+            SendAdminEmail(msg, subject);
+            msg = subject + "\n" + msg;
+            Log.Error(msg);
+        }
+
         /// <summary>
         /// Send a notification email to the AdminEmailAdress.
         /// </summary>
-- 
GitLab