Access to branding information. Only the ApplicationName is guaranteed to be non-null.
コード例 #1
0
ファイル: LoggingService.cs プロジェクト: zendbit/monodevelop
        static LoggingService()
        {
            var consoleLogger = new ConsoleLogger();

            loggers.Add(consoleLogger);
            loggers.Add(new InstrumentationLogger());

            string consoleLogLevelEnv = Environment.GetEnvironmentVariable("MONODEVELOP_CONSOLE_LOG_LEVEL");

            if (!string.IsNullOrEmpty(consoleLogLevelEnv))
            {
                try {
                    consoleLogger.EnabledLevel = (EnabledLoggingLevel)Enum.Parse(typeof(EnabledLoggingLevel), consoleLogLevelEnv, true);
                } catch (Exception e) {
                    LogError("Error setting log level", e);
                }
            }

            string consoleLogUseColourEnv = Environment.GetEnvironmentVariable("MONODEVELOP_CONSOLE_LOG_USE_COLOUR");

            if (!string.IsNullOrEmpty(consoleLogUseColourEnv) && consoleLogUseColourEnv.ToLower() == "false")
            {
                consoleLogger.UseColour = false;
            }
            else
            {
                consoleLogger.UseColour = true;
            }

            string logFileEnv = Environment.GetEnvironmentVariable("MONODEVELOP_LOG_FILE");

            if (!string.IsNullOrEmpty(logFileEnv))
            {
                try {
                    var fileLogger = new FileLogger(logFileEnv);
                    loggers.Add(fileLogger);
                    string logFileLevelEnv = Environment.GetEnvironmentVariable("MONODEVELOP_FILE_LOG_LEVEL");
                    fileLogger.EnabledLevel = (EnabledLoggingLevel)Enum.Parse(typeof(EnabledLoggingLevel), logFileLevelEnv, true);
                } catch (Exception e) {
                    LogError("Error setting custom log file", e);
                }
            }

            timestamp = DateTime.Now;

#if ENABLE_RAYGUN
            string raygunKey = BrandingService.GetString("RaygunApiKey");
            if (raygunKey != null)
            {
                raygunClient = new RaygunClient(raygunKey);
            }
#endif

            //remove the default trace listener on .NET, it throws up horrible dialog boxes for asserts
            Debug.Listeners.Clear();

            //add a new listener that just logs failed asserts
            Debug.Listeners.Add(new AssertLoggingTraceListener());
        }
コード例 #2
0
ファイル: UserProfile.cs プロジェクト: zcf7822/monodevelop
        internal static UserProfile GetProfile(string profileVersion)
        {
            var brandedEnvVar = BrandingService.BrandEnvironmentVariable(PROFILE_ENV_VAR);

            FilePath testProfileRoot = Environment.GetEnvironmentVariable(brandedEnvVar);

            if (!testProfileRoot.IsNullOrEmpty)
            {
                return(UserProfile.ForTest(profileVersion, testProfileRoot));
            }

            if (Platform.IsWindows)
            {
                return(UserProfile.ForWindows(profileVersion));
            }
            else if (Platform.IsMac)
            {
                return(UserProfile.ForMac(profileVersion));
            }
            else
            {
                return(UserProfile.ForUnix(profileVersion));
            }
        }