// -- connstructor /// <summary> /// /// </summary> public BatteryPackSimulator() { _log = LoggingProvider.CreateLogger <BatteryPackSimulator>(); _args = new BatteryArgs(); }
public void SetConfiguration(Configuration configuration) { Configuration = configuration ?? Configuration.Default(); Logging = new LoggingProvider(Configuration.Logger); InitializeHttpClient(); }
// -- constructors public D3vS1mFactory() : base() { _log = LoggingProvider.CreateLogger <D3vS1mFactory>(); base.Simulators = new SimulatorRepository(); }
private void SetupLogging() { loggingProvider = (LoggingProvider)ObjectFactory.GetProvider <ILoggingProvider>(); loggingProvider.OnLogEntry += OnLogEntry; }
public GitHubVersionChecker() { this._log = LoggingProvider.GetLogger <GitHubVersionChecker>(); }
public AdaptedFriisSimulator(RuntimeBase runtime) : base(runtime) { _log = LoggingProvider.CreateLogger <SimulatorBase>(); }
static BaseTest() { LoggingProvider.Use(LoggingProvider.ConsoleLoggingProvider); }
public BatteryPackSimulator(RuntimeBase runtime) : base(runtime) { _log = LoggingProvider.CreateLogger <BatteryPackSimulator>(); }
public SphericAntennaSimulator(RuntimeBase runtime) : base(runtime) { _log = LoggingProvider.CreateLogger <SphericAntennaSimulator>(); }
public IPagedCollection <LogEntry> GetPagedItems(int pageIndex, int pageSize) { return(LoggingProvider.Instance().GetPagedLogEntries(pageIndex, pageSize)); }
public BusinessService(DataStoreProvider dataStoreProvider, LoggingProvider loggingProvider, WebServiceProvider webServiceProvider) { _dataStoreProvider = dataStoreProvider; _loggingProvider = loggingProvider; _webServiceProvider = webServiceProvider; }
public void IsCreate() { LoggingProvider.InitiateFolder(); }
/// <summary> /// LogEnd logs the Application Start Event. /// </summary> public static void LogEnd() { try { ApplicationShutdownReason shutdownReason = HostingEnvironment.ShutdownReason; string shutdownDetail; switch (shutdownReason) { case ApplicationShutdownReason.BinDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the Bin folder or files contained in it."; break; case ApplicationShutdownReason.BrowsersDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the App_Browsers folder or files contained in it."; break; case ApplicationShutdownReason.ChangeInGlobalAsax: shutdownDetail = "The AppDomain shut down because of a change to Global.asax."; break; case ApplicationShutdownReason.ChangeInSecurityPolicyFile: shutdownDetail = "The AppDomain shut down because of a change in the code access security policy file."; break; case ApplicationShutdownReason.CodeDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the App_Code folder or files contained in it."; break; case ApplicationShutdownReason.ConfigurationChange: shutdownDetail = "The AppDomain shut down because of a change to the application level configuration."; break; case ApplicationShutdownReason.HostingEnvironment: shutdownDetail = "The AppDomain shut down because of the hosting environment."; break; case ApplicationShutdownReason.HttpRuntimeClose: shutdownDetail = "The AppDomain shut down because of a call to Close."; break; case ApplicationShutdownReason.IdleTimeout: shutdownDetail = "The AppDomain shut down because of the maximum allowed idle time limit."; break; case ApplicationShutdownReason.InitializationError: shutdownDetail = "The AppDomain shut down because of an AppDomain initialization error."; break; case ApplicationShutdownReason.MaxRecompilationsReached: shutdownDetail = "The AppDomain shut down because of the maximum number of dynamic recompiles of resources limit."; break; case ApplicationShutdownReason.PhysicalApplicationPathChanged: shutdownDetail = "The AppDomain shut down because of a change to the physical path for the application."; break; case ApplicationShutdownReason.ResourcesDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the App_GlobalResources folder or files contained in it."; break; case ApplicationShutdownReason.UnloadAppDomainCalled: shutdownDetail = "The AppDomain shut down because of a call to UnloadAppDomain."; break; default: shutdownDetail = "Shutdown reason: " + shutdownReason; break; } var log = new LogInfo { BypassBuffering = true, LogTypeKey = EventLogType.APPLICATION_SHUTTING_DOWN.ToString(), }; log.AddProperty("Shutdown Details", shutdownDetail); LogController.Instance.AddLog(log); // enhanced shutdown logging var runtime = typeof(HttpRuntime).InvokeMember( "_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null) as HttpRuntime; if (runtime == null) { Logger.InfoFormat("Application shutting down. Reason: {0}", shutdownDetail); } else { var shutDownMessage = runtime.GetType().InvokeMember( "_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null) as string; var shutDownStack = runtime.GetType().InvokeMember( "_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null) as string; Logger.Info("Application shutting down. Reason: " + shutdownDetail + Environment.NewLine + "ASP.NET Shutdown Info: " + shutDownMessage + Environment.NewLine + shutDownStack); } } catch (Exception exc) { Exceptions.LogException(exc); } var status = Globals.DependencyProvider.GetRequiredService <IApplicationStatusInfo>().Status; if (status != UpgradeStatus.Install) { // purge log buffer LoggingProvider.Instance().PurgeLogBuffer(); } }
// -- constructors public AdaptedFriisSimulator() { _log = LoggingProvider.CreateLogger <AdaptedFriisSimulator>(); _args = new AdaptedFriisArgs(); }
// -- constructor protected RuntimeBase() { _log = LoggingProvider.CreateLogger <RuntimeBase>(); _simRepo = new SimulatorRepository(); }
private void btnClearLog_Click(object sender, EventArgs e) { LoggingProvider.Instance().ClearLog(); resultsPager.PageIndex = 0; //Back to first page. BindList(); }
// -- constructor protected RuntimeBase() { _log = LoggingProvider.CreateLogger <RuntimeBase>(); BindSimulators(new SimulatorRepository()); Started += OnStart; }
/// ----------------------------------------------------------------------------- /// <summary> /// LogEnd logs the Application Start Event /// </summary> /// ----------------------------------------------------------------------------- public static void LogEnd() { try { ApplicationShutdownReason shutdownReason = HostingEnvironment.ShutdownReason; string shutdownDetail; switch (shutdownReason) { case ApplicationShutdownReason.BinDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the Bin folder or files contained in it."; break; case ApplicationShutdownReason.BrowsersDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the App_Browsers folder or files contained in it."; break; case ApplicationShutdownReason.ChangeInGlobalAsax: shutdownDetail = "The AppDomain shut down because of a change to Global.asax."; break; case ApplicationShutdownReason.ChangeInSecurityPolicyFile: shutdownDetail = "The AppDomain shut down because of a change in the code access security policy file."; break; case ApplicationShutdownReason.CodeDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the App_Code folder or files contained in it."; break; case ApplicationShutdownReason.ConfigurationChange: shutdownDetail = "The AppDomain shut down because of a change to the application level configuration."; break; case ApplicationShutdownReason.HostingEnvironment: shutdownDetail = "The AppDomain shut down because of the hosting environment."; break; case ApplicationShutdownReason.HttpRuntimeClose: shutdownDetail = "The AppDomain shut down because of a call to Close."; break; case ApplicationShutdownReason.IdleTimeout: shutdownDetail = "The AppDomain shut down because of the maximum allowed idle time limit."; break; case ApplicationShutdownReason.InitializationError: shutdownDetail = "The AppDomain shut down because of an AppDomain initialization error."; break; case ApplicationShutdownReason.MaxRecompilationsReached: shutdownDetail = "The AppDomain shut down because of the maximum number of dynamic recompiles of resources limit."; break; case ApplicationShutdownReason.PhysicalApplicationPathChanged: shutdownDetail = "The AppDomain shut down because of a change to the physical path for the application."; break; case ApplicationShutdownReason.ResourcesDirChangeOrDirectoryRename: shutdownDetail = "The AppDomain shut down because of a change to the App_GlobalResources folder or files contained in it."; break; case ApplicationShutdownReason.UnloadAppDomainCalled: shutdownDetail = "The AppDomain shut down because of a call to UnloadAppDomain."; break; default: shutdownDetail = "No shutdown reason provided."; break; } var log = new LogInfo { BypassBuffering = true, LogTypeKey = EventLogController.EventLogType.APPLICATION_SHUTTING_DOWN.ToString() }; log.AddProperty("Shutdown Details", shutdownDetail); LogController.Instance.AddLog(log); Logger.InfoFormat("Application shutting down. Reason: {0}", shutdownDetail); } catch (Exception exc) { Exceptions.LogException(exc); } if (Globals.Status != Globals.UpgradeStatus.Install) { //purge log buffer LoggingProvider.Instance().PurgeLogBuffer(); } }
// -- methods public ObjReader(string file) { _log = LoggingProvider.CreateLogger <ObjReader>(); _file = file; }
private void Initialize() { LoggingProviderSection loggingConfig = null; // 找到配置文件中“LoggingProvider”节点 loggingConfig = ConfigurationManager.GetSection(sectionName) as LoggingProviderSection; if (loggingConfig == null) return; providers = new LoggingProviderCollection(); // 使用System.Web.Configuration.ProvidersHelper类调用每个Provider的Initialize()方法 ProvidersHelper.InstantiateProviders(loggingConfig.Providers, providers, typeof(LoggingProvider)); // 所用的Provider为配置中默认的Provider defaultProvider = providers[loggingConfig.DefaultProvider] as LoggingProvider; urlLogProvider = providers[loggingConfig.UrlLogProvider] as LoggingProvider; dataLogProvider = providers[loggingConfig.DataLogProvider] as LoggingProvider; }
public ScriptManager(LoggingProvider logger, SoftwareConfiguration configuration) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } for (int i = 0; i < 8; i++) { channels.Add(new VolumeChannel("XXX", "XXX", logger)); } try { // TODO: consider using the advice in https://github.com/Microsoft/ClearScript/issues/65 instead of using WeakReferences. WeakReference <List <Channel> > weakChannelList = new WeakReference <List <Channel> >(channels); _engine.AddHostObject("host", new ExtendedHostFunctions()); _engine.AddHostObject("AddVolumeChannel", (Func <int, String, String, int>)((int c, String displayName, String exeSuffix) => { List <Channel> localChannels; if (weakChannelList.TryGetTarget(out localChannels)) { localChannels[c] = new VolumeChannel(displayName, exeSuffix, logger); } return(0); })); _engine.AddHostType("ScriptChannelCallback", typeof(ScriptChannelCallback)); _engine.AddHostObject("AddScriptChannelInternal", (Func <int, ScriptChannelCallback, ScriptChannel>)((int c, ScriptChannelCallback config) => { ScriptChannel nc; ScriptChannel dv = ScriptChannel.ConstructForScript(config, out nc); List <Channel> localChannels; if (weakChannelList.TryGetTarget(out localChannels)) { localChannels[c] = nc; } return(dv); })); _engine.Execute("builtin.js", Software.Properties.Resources.BuiltInScript); if (!File.Exists(configuration.ConfigFilePath)) { File.WriteAllText(configuration.ConfigFilePath, Software.Properties.Resources.DefaultConfigScript); } _engine.Execute(configuration.ConfigFilePath, File.ReadAllText(configuration.ConfigFilePath)); } catch (ScriptEngineException e) { MessageBox.Show(e.ErrorDetails, "Error executing config.js", MessageBoxButtons.OK); throw e; } }