当前位置: 首页>>代码示例>>C#>>正文


C# Logging类代码示例

本文整理汇总了C#中Logging的典型用法代码示例。如果您正苦于以下问题:C# Logging类的具体用法?C# Logging怎么用?C# Logging使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Logging类属于命名空间,在下文中一共展示了Logging类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateGrid

        public ActionResult UpdateGrid(string hiddenSchoolFilter, string hiddenSchoolYearFilter)
        {
            try
            {
                dbTIREntities db = new dbTIREntities();
                SiteUser siteUser = ((SiteUser)Session["SiteUser"]);
                StudentService studentService = new StudentService(siteUser, db);
                SchoolService schoolService = new SchoolService(siteUser, db);
                ModelServices modelService = new ModelServices();
                ViewBag.DistrictDesc = siteUser.Districts[0].Name;
                int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(hiddenSchoolYearFilter));
                ViewBag.SchoolId = modelService.DropDownDataSchool(hiddenSchoolFilter, siteUser.EdsUserId, schoolYearId, true);
                ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT");
                ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(hiddenSchoolYearFilter);

                ViewBag.SchoolYear = hiddenSchoolYearFilter;

                return View("Index", new SiteModels()
                {
                    Students = studentService.GetViewData(hiddenSchoolYearFilter, hiddenSchoolFilter)
                });
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return View("GeneralError");
            }
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.NetMVC,代码行数:29,代码来源:StudentsController.cs

示例2: MetadataUtils

 public MetadataUtils(Config.Saml2Configuration configuration, Logging.IInternalLogger logger)
 {
     if (configuration == null) throw new ArgumentNullException("configuration");
     if (logger == null) throw new ArgumentNullException("logger");
     this.configuration = configuration;
     this.logger = logger;
 }
开发者ID:jbparker,项目名称:SAML2,代码行数:7,代码来源:MetadataUtils.cs

示例3: Log

 /// <summary>
 /// Logs the information at the provided level.
 /// </summary>
 /// <param name="level">The logging level.</param>
 /// <param name="messageFormat">The message format.</param>
 /// <param name="args">The arguments.</param>
 public void Log(Logging.LogLevel level, string messageFormat, params object[] args)
 {
     switch (level)
     {
         case Logging.LogLevel.Fatal:
             this.logger.Fatal(messageFormat, args);
             break;
         case Logging.LogLevel.Error:
             this.logger.Error(messageFormat, args);
             break;
         case Logging.LogLevel.Warning:
             this.logger.Warn(messageFormat, args);
             break;
         case Logging.LogLevel.Info:
             this.logger.Info(messageFormat, args);
             break;
         case Logging.LogLevel.Debug:
             this.logger.Debug(messageFormat, args);
             break;
         case Logging.LogLevel.Trace:
             this.logger.Trace(messageFormat, args);
             break;
         default:
             this.logger.Trace(messageFormat, args);
             break;
     }
 }
开发者ID:movileanubeniamin,项目名称:kephas,代码行数:33,代码来源:InternalLogger.cs

示例4: Validation

        public Validation()
        {
            _tfsServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["TfsServer"]));
            _vsoServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["VsoServer"]));
            _vsoStore = _vsoServer.GetService<WorkItemStore>();
            _tfsStore = _tfsServer.GetService<WorkItemStore>();

            var actionValue = ConfigurationManager.AppSettings["Action"];
            if (actionValue.Equals("validate", StringComparison.OrdinalIgnoreCase))
            {
                _action = Action.Validate;
            }
            else
            {
                _action = Action.Compare;
            }

            var runDateTime = DateTime.Now.ToString("yyyy-MM-dd-HHmmss");

            var dataFilePath = ConfigurationManager.AppSettings["DataFilePath"];
            var dataDir = string.IsNullOrWhiteSpace(dataFilePath) ? Directory.GetCurrentDirectory() : dataFilePath;
            var dirName = string.Format("{0}\\Log-{1}",dataDir,runDateTime);

            if (!Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            _errorLog = new Logging(string.Format("{0}\\Error.txt", dirName));
            _statusLog = new Logging(string.Format("{0}\\Status.txt", dirName));
            _fullLog = new Logging(string.Format("{0}\\FullLog.txt", dirName));

            _taskList = new List<Task>();

            if (!_action.Equals(Action.Compare))
            {
                return;
            }

            _valFieldErrorLog = new Logging(string.Format("{0}\\FieldError.txt", dirName));
            _valTagErrorLog = new Logging(string.Format("{0}\\TagError.txt", dirName));
            _valPostMigrationUpdateLog = new Logging(string.Format("{0}\\PostMigrationUpdate.txt", dirName));

            _imageLog = new Logging(string.Format("{0}\\ItemsWithImage.txt", dirName));

            _commonFields = new List<string>();
            _itemTypesToValidate = new List<string>();

            var fields = ConfigurationManager.AppSettings["CommonFields"].Split(',');
            foreach (var field in fields)
            {
                _commonFields.Add(field);
            }

            var types = ConfigurationManager.AppSettings["WorkItemTypes"].Split(',');
            foreach (var type in types)
            {
                _itemTypesToValidate.Add(type);
            }
        }
开发者ID:hshishir,项目名称:ValidationTool,代码行数:60,代码来源:Validation.cs

示例5: ViewMatchSessions

 public ViewMatchSessions(
     Logging.LoggingInterfaces.ITracer logger)
 {
     this.logger = logger;
     this.context = FSharpInterop.Interop.GetNewContext();
     InitializeComponent();
 }
开发者ID:matthid,项目名称:Yaaf.GameMediaManager,代码行数:7,代码来源:ViewMatchSessions.cs

示例6: Log

        /// <summary>
        /// Logs the information at the provided level.
        /// </summary>
        /// <param name="level">        The logging level.</param>
        /// <param name="exception">    The exception.</param>
        /// <param name="messageFormat">The message format.</param>
        /// <param name="args">         A variable-length parameters list containing arguments.</param>
        public void Log(Logging.LogLevel level, Exception exception, string messageFormat, params object[] args)
        {
            if (exception == null)
            {
                this.Log(level, messageFormat, args);
                return;
            }

            switch (level)
            {
                case Logging.LogLevel.Fatal:
                    this.logger.Fatal(exception, messageFormat, args);
                    break;
                case Logging.LogLevel.Error:
                    this.logger.Error(exception, messageFormat, args);
                    break;
                case Logging.LogLevel.Warning:
                    this.logger.Warn(exception, messageFormat, args);
                    break;
                case Logging.LogLevel.Info:
                    this.logger.Info(exception, messageFormat, args);
                    break;
                case Logging.LogLevel.Debug:
                    this.logger.Debug(exception, messageFormat, args);
                    break;
                case Logging.LogLevel.Trace:
                    this.logger.Trace(exception, messageFormat, args);
                    break;
                default:
                    this.logger.Trace(exception, messageFormat, args);
                    break;
            }
        }
开发者ID:raimu,项目名称:kephas,代码行数:40,代码来源:NLogger.cs

示例7: Index

        // GET: /Students/
        public ActionResult Index()
        {
            try
            {
                dbTIREntities db = new dbTIREntities();
                SiteUser siteUser = ((SiteUser)Session["SiteUser"]);
                StudentService studentService = new StudentService(siteUser, db);
                SchoolService schoolService = new SchoolService(siteUser, db);
                ModelServices modelService = new ModelServices();
                string currentSchoolYear = schoolService.GetCurrentSchoolYear();
                ViewBag.DistrictDesc = siteUser.Districts[0].Name;
                int schoolYearId = modelService.SchoolYearId();
                ViewBag.SchoolId = modelService.DropDownDataSchool("", siteUser.EdsUserId, schoolYearId, true);
                ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT");
                //ViewBag.SchoolYear = HelperService.SchoolYearDescription(db);
                ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(currentSchoolYear);
                ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT");
                ViewBag.SchoolYear = currentSchoolYear;

                return View(new SiteModels()
                {
                    Students = studentService.GetViewData(currentSchoolYear, "", "")
                });
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return View("GeneralError");
            }
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.NetMVC,代码行数:32,代码来源:StudentsController.cs

示例8: SharedObjects

 static SharedObjects()
 {
     ProgramName = string.Empty;
     MainWin = (Form)null;
     ProgramExit = false;
     Log = new Logging();
 }
开发者ID:x893,项目名称:BTool,代码行数:7,代码来源:SharedObjects.cs

示例9: Logging_LogMessage

        void Logging_LogMessage(object sender, Logging.LogMessageEventArgs e)
        {
            CWSRestart.Controls.LogFilter.MessageType t = Controls.LogFilter.MessageType.General;

            switch (e.type)
            {
                case Logging.MessageType.Error:
                    t = Controls.LogFilter.MessageType.Error;
                    break;

                case Logging.MessageType.Info:
                    t = Controls.LogFilter.MessageType.Info;
                    break;

                case Logging.MessageType.Server:
                    t = Controls.LogFilter.MessageType.Server;
                    break;

                case Logging.MessageType.Warning:
                    t = Controls.LogFilter.MessageType.Warning;
                    break;
            }

            Application.Current.Dispatcher.BeginInvoke(new Action<Controls.LogFilter.LogMessage>((m) => LogControl.Messages.Add(m)), new Controls.LogFilter.LogMessage(e.message, t)); 
        }
开发者ID:GuardMoony,项目名称:CWSRestart,代码行数:25,代码来源:FrontEnd.xaml.cs

示例10: EmailerService

        public EmailerService(Logging.ILogger logger
			, Services.IConnectorService connectorService
			, Services.IAccountService accountService
			, Services.CryptoService cryptoService
			, Services.IScheduledTaskService taskService
			)
        {
            this.Logger = logger;
            this.ConnectorService = connectorService;
            this.CryptoService = cryptoService;
            this.AccountService = accountService;
            this.TaskService = taskService;

            var smtpSection = System.Configuration.ConfigurationManager.GetSection("system.net/mailSettings/smtp") as System.Net.Configuration.SmtpSection;
            if (!smtpSection.From.IsNullOrTrimmedEmpty())
            {
                m_MailFrom = new MailAddress(smtpSection.From);
            }
            else
            {
                m_MailFrom = new MailAddress(ERPStoreApplication.WebSiteSettings.Contact.EmailSender,
                               ERPStoreApplication.WebSiteSettings.Contact.EmailSenderName);
            }

            var bccEmail = ERPStoreApplication.WebSiteSettings.Contact.BCCEmail ?? ERPStoreApplication.WebSiteSettings.Contact.ContactEmail;
            m_Bcc = new MailAddressCollection();
            if (bccEmail != null)
            {
                var emailList = bccEmail.Split(';');
                foreach (var email in emailList)
                {
                    m_Bcc.Add(email.Trim());
                }
            }
        }
开发者ID:hhariri,项目名称:ReSharper8Demo,代码行数:35,代码来源:EmailerService.cs

示例11: FetchMatchdataDialog

 public FetchMatchdataDialog(Logging.LoggingInterfaces.ITracer logger, string defaultLink)
 {
     this.logger = logger;
     Result = null;
     InitializeComponent();
     linkTextBox.Text = defaultLink;
 }
开发者ID:matthid,项目名称:Yaaf.GameMediaManager,代码行数:7,代码来源:FetchMatchdataDialog.cs

示例12: IsEnabled

        /// <summary>
        /// Indicates whether logging at the indicated level is enabled.
        /// </summary>
        /// <param name="level">The logging level.</param>
        /// <returns>
        /// <c>true</c> if enabled, <c>false</c> if not.
        /// </returns>
        public bool IsEnabled(Logging.LogLevel level)
        {
            if (this.logger.IsTraceEnabled)
            {
                return level <= Logging.LogLevel.Trace;
            }

            if (this.logger.IsDebugEnabled)
            {
                return level <= Logging.LogLevel.Debug;
            }

            if (this.logger.IsInfoEnabled)
            {
                return level <= Logging.LogLevel.Info;
            }

            if (this.logger.IsWarnEnabled)
            {
                return level <= Logging.LogLevel.Warning;
            }

            if (this.logger.IsErrorEnabled)
            {
                return level <= Logging.LogLevel.Error;
            }

            if (this.logger.IsFatalEnabled)
            {
                return level <= Logging.LogLevel.Fatal;
            }

            return false;
        }
开发者ID:raimu,项目名称:kephas,代码行数:41,代码来源:NLogger.cs

示例13: HttpContextCartRepository

        public HttpContextCartRepository(System.Web.HttpContext ctx
			, Services.ICacheService cacheService
			, Logging.ILogger logger)
        {
            HttpContext = ctx;
            CacheService = cacheService;
            this.Logger = logger;
        }
开发者ID:hhariri,项目名称:ReSharper8Demo,代码行数:8,代码来源:HttpContextCartRepository.cs

示例14: SettingsService

        public SettingsService(ERPStore.Services.ICacheService cacheService
			, Logging.ILogger logger
			, Microsoft.Practices.Unity.IUnityContainer container)
        {
            this.CacheService = cacheService;
            this.Logger = logger;
            this.Container = container;
        }
开发者ID:hhariri,项目名称:ReSharper8Demo,代码行数:8,代码来源:SettingsService.cs

示例15: When_config_section_threshold_is_null_threshold_should_be_null

 public void When_config_section_threshold_is_null_threshold_should_be_null()
 {
     var configSection = new Logging
     {
         Threshold = null
     };
     Assert.IsNull(SetLoggingLibrary.GetThresholdFromConfigSection(configSection));
 }
开发者ID:89sos98,项目名称:NServiceBus,代码行数:8,代码来源:SetLoggingLibraryTests.cs


注:本文中的Logging类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。