示例#1
0
        public async Task <ActionResult> Level(string logLevel, string application)
        {
            application = application ?? string.Empty;

            if (application == CcmApplications.Web)
            {
                var wasSet = LogLevelManager.SetLogLevel(logLevel);
                if (wasSet)
                {
                    log.Info("Log level changed to {0}", logLevel);
                }
                else
                {
                    log.Info("Log level was NOT changed. ({0})", logLevel);
                }
            }
            else if (application == CcmApplications.Discovery)
            {
                var result = await SetDiscoveryLogLevelAsync(logLevel);

                if (result != logLevel)
                {
                    ViewBag.CurrentLevel = logLevel;
                    ViewBag.Application  = application;
                    return(View());
                }
            }

            return(RedirectToAction("Index", new { application }));
        }
示例#2
0
        public ActionResult <string> SetLogLevel([FromBody] SetLogLevelRequest request)
        {
            LogLevelManager.SetLogLevel(request.LogLevel);
            var newLevel = LogLevelManager.GetCurrentLevel().Name;

            return(newLevel);
        }
示例#3
0
        public LevelModel Post(LevelModel levelModel)
        {
            if (levelModel != null)
            {
                var isSet = LogLevelManager.SetLogLevel(levelModel.LogLevel);
                if (isSet)
                {
                    log.Info("Log level changed to {0}", levelModel.LogLevel);
                }
                else
                {
                    log.Info("Log level was NOT changed.");
                }
            }

            return(Get());
        }