本文整理汇总了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");
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例5: ViewMatchSessions
public ViewMatchSessions(
Logging.LoggingInterfaces.ITracer logger)
{
this.logger = logger;
this.context = FSharpInterop.Interop.GetNewContext();
InitializeComponent();
}
示例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;
}
}
示例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");
}
}
示例8: SharedObjects
static SharedObjects()
{
ProgramName = string.Empty;
MainWin = (Form)null;
ProgramExit = false;
Log = new Logging();
}
示例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));
}
示例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());
}
}
}
示例11: FetchMatchdataDialog
public FetchMatchdataDialog(Logging.LoggingInterfaces.ITracer logger, string defaultLink)
{
this.logger = logger;
Result = null;
InitializeComponent();
linkTextBox.Text = defaultLink;
}
示例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;
}
示例13: HttpContextCartRepository
public HttpContextCartRepository(System.Web.HttpContext ctx
, Services.ICacheService cacheService
, Logging.ILogger logger)
{
HttpContext = ctx;
CacheService = cacheService;
this.Logger = logger;
}
示例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;
}
示例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));
}