private void APIAccount_Load(object sender, EventArgs e) { if (apiContext == null) { apiContext = AppSettingHelper.GetApiContext(); apiContext.ApiLogManager = new ApiLogManager(); LoggingProperties logProps = AppSettingHelper.GetLoggingProperties(); apiContext.ApiLogManager.ApiLoggerList.Add(new FileLogger(logProps.LogFileName, true, true, true)); apiContext.ApiLogManager.EnableLogging = true; apiContext.Site = SiteCodeType.US; } string[] sites = Enum.GetNames(typeof(SiteCodeType)); foreach (string site in sites) { if (site != "CustomCode") { CboSite.Items.Add(site); } } string[] langs = Enum.GetNames(typeof(ErrorLanguageCodeType)); foreach (string lang in langs) { if (lang != "CustomCode") { CboLanguage.Items.Add(lang); } } CboSite.SelectedIndex = 0; SetBindings(); }
private ExceptionFilter GetExceptionFilter(LoggingProperties logProps) { if (logProps.LogPayloadErrorCodes == null && logProps.LogPayloadExceptions == null && logProps.LogPayloadHttpStatusCodes == null) { return(null); } else { return(new ExceptionFilter(logProps.LogPayloadErrorCodes, logProps.LogPayloadExceptions, logProps.LogPayloadHttpStatusCodes)); } }
private void APIMain_Load(object sender, EventArgs e) { apiContext = AppSettingHelper.GetApiContext(); apiContext.ApiLogManager = new ApiLogManager(); LoggingProperties logProps = AppSettingHelper.GetLoggingProperties(); apiContext.ApiLogManager.ApiLoggerList.Add(new FileLogger(logProps.LogFileName, true, true, true)); apiContext.ApiLogManager.EnableLogging = true; apiContext.ApiLogManager.MessageLoggingFilter = GetExceptionFilter(logProps); apiContext.Site = eBay.Service.Core.Soap.SiteCodeType.US; SetProxy(); }
private void FrmMain_Load(object sender, System.EventArgs e) { Context = AppSettingHelper.GetApiContext(); Context.ApiLogManager = new ApiLogManager(); LoggingProperties logProps = AppSettingHelper.GetLoggingProperties(); Context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger(logProps.LogFileName, true, true, true)); Context.ApiLogManager.EnableLogging = true; Context.ApiLogManager.MessageLoggingFilter = getExceptionFilter(logProps); Context.Site = eBay.Service.Core.Soap.SiteCodeType.US; //set proxy server if necessary SetProxy(); }
/// <summary> /// Update the specified service properties according to the input /// </summary> /// <param name="logging">Service properties</param> internal void UpdateServiceProperties(LoggingProperties logging) { if (Version != null) { logging.Version = Version.ToString(); } if (RetentionDays != null) { if (RetentionDays == -1) { //Disable logging retention policy logging.RetentionDays = null; } else if (RetentionDays < 1 || RetentionDays > 365) { throw new ArgumentException(string.Format(Resources.InvalidRetentionDay, RetentionDays)); } else { logging.RetentionDays = RetentionDays; } } if (LoggingOperations != null && LoggingOperations.Length > 0) { LoggingOperations logOperations = default(LoggingOperations); for (int i = 0; i < LoggingOperations.Length; i++) { if (LoggingOperations[i] == StorageClient.LoggingOperations.None || LoggingOperations[i] == StorageClient.LoggingOperations.All) { if (LoggingOperations.Length > 1) { throw new ArgumentException(Resources.NoneAndAllOperationShouldBeAlone); } } logOperations |= LoggingOperations[i]; } logging.LoggingOperations = logOperations; // Set default logging version if (string.IsNullOrEmpty(logging.Version)) { string defaultLoggingVersion = StorageNouns.DefaultLoggingVersion; logging.Version = defaultLoggingVersion; } } }
private static LoggingProperties Clone(LoggingProperties logging) { if (logging == null) { return(null); } return(new LoggingProperties { LoggingOperations = logging.LoggingOperations, RetentionDays = logging.RetentionDays, Version = logging.Version }); }
public static async Task EnableLoggingAsync(IStorageBlobClient blobClient, CancellationToken cancellationToken) { ServiceProperties serviceProperties = await blobClient.GetServicePropertiesAsync(cancellationToken); // Merge write onto it. LoggingProperties loggingProperties = serviceProperties.Logging; if (loggingProperties.LoggingOperations == LoggingOperations.None) { // First activating. Be sure to set a retention policy if there isn't one. loggingProperties.RetentionDays = 7; loggingProperties.LoggingOperations |= LoggingOperations.Write; // Leave metrics untouched await blobClient.SetServicePropertiesAsync(serviceProperties, cancellationToken); } }
// Init all ebay accounts context. public static void InitAllAccounts() { foreach (AccountType account in allAccounts) { ApiContext context = AppSettingHelper.GetApiContext(account.ebayToken); if (context == null) { //MessageBox.Show("初始化Ebay服务器连接失败,请查看网络或者配置情况!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } context.ApiLogManager = new ApiLogManager(); LoggingProperties logProps = AppSettingHelper.GetLoggingProperties(); context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger(logProps.LogFileName, true, true, true)); context.ApiLogManager.EnableLogging = true; context.ApiLogManager.MessageLoggingFilter = getExceptionFilter(logProps); context.Site = eBay.Service.Core.Soap.SiteCodeType.US; account.SellerApiContext = context; } }