From 53e13e0233f9123d153a570083d330d861f83d8f Mon Sep 17 00:00:00 2001 From: Dmytro Aleksandrov Date: Fri, 26 Jun 2015 12:12:09 +0300 Subject: [PATCH] use http://stackoverflow.com/questions/721161/how-to-detect-which-net-runtime-is-being-used-ms-vs-mono to detect mono runtime --- src/LogentriesCore/AsyncLogger.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/LogentriesCore/AsyncLogger.cs b/src/LogentriesCore/AsyncLogger.cs index da3182b..64ccd81 100644 --- a/src/LogentriesCore/AsyncLogger.cs +++ b/src/LogentriesCore/AsyncLogger.cs @@ -470,6 +470,11 @@ public static bool IsNullOrWhiteSpace(String value) return true; } + public static bool isRunningOnMono() + { + return Type.GetType("Mono.Runtime") != null; + } + /* Retrieve configuration settings * Will check Enviroment Variable as the last fall back. * @@ -477,7 +482,7 @@ public static bool IsNullOrWhiteSpace(String value) private string retrieveSetting(String name) { string cloudconfig = null; - if (Environment.OSVersion.Platform == PlatformID.Unix) + if (isRunningOnMono()) { cloudconfig = ConfigurationManager.AppSettings.Get(name); } @@ -604,7 +609,7 @@ protected virtual void WriteDebugMessages(string message) #endregion - #region publicMethods + #region Public Methods public virtual void AddLine(string line) {