public LMLoggers(NCCConfig.Config cfg) { this.cfg = cfg; reps = new Hashtable((int)AppSection.Rarrr); int pid = Process.GetCurrentProcess().Id; foreach (AppSection wp in Enum.GetValues(typeof(AppSection))) { LognLM l = new LognLM(wp.ToString(), cfg, pid); reps.Add(wp, l); } }
public LognLM(string section, NCCConfig.Config cfg, int pid) { FileLogTraceListener listener = null; ts = new TraceSource(section); try { foreach (TraceListener item in ts.Listeners) { // every file logger points to the same file and has the same attributes, they are really a merged logger set (for now, until we need something else) if (item is FileLogTraceListener) { listener = (FileLogTraceListener)item; listener.BaseFileName = String.Format("NCC6[{0,4}]", pid); // add thread id here listener.Append = true; listener.AutoFlush = false; // dev note: expose a setter for this property, to set true for critical passages if (!NCCConfig.Config.isDefaultPath(cfg.App.RootLoc)) { listener.Location = LogFileLocation.Custom; listener.CustomLocation = cfg.App.RootLoc; } listener.MaxFileSize = cfg.App.RolloverSizeMB * 1024 * 1024; // logdetails cmd line flag crudely enables this option set, only because the App.Config sharedListeners and switch source sections do not permit setting this attribute. if (cfg.App.isSet(NCCConfig.NCCFlags.logDetails)) item.TraceOutputOptions |= cfg.App.LoggingDetailOptions; } else { // item.TraceOutputOptions |= (TraceOptions.DateTime | TraceOptions.ThreadId); } } } catch(Exception e) { Console.WriteLine(e.Message); } if (cfg.App.IsLevelSet()) // use the cmd line or UI override, if one is present, { // test: but if the internal switch value was higher as set in app.config, this assignment is either overridden later or has no effect on the pre-constructed switches if (ts != null) { ts.Switch.Level = cfg.App.Level(); } } }
// used by file ops only public void SetLMState(NCCConfig.LMMMNetComm config, uint unitbytes = 8, bool useRawBuff = false) { State.useAsynch = config.UseAsynchAnalysis; State.includingGen2 = NC.App.AppContext.ParseGen2; State.usingStreamRawAnalysis = config.UsingStreamRawAnalysis; statusCheckCount = NC.App.AppContext.StatusPacketCount; State.InitParseBuffers(config.ParseBufferSize, unitbytes, useRawBuff); }
public void SetLMStateFlags(NCCConfig.LMMMNetComm config) { State.useAsynch = config.UseAsynchAnalysis; State.includingGen2 = NC.App.AppContext.ParseGen2; State.usingStreamRawAnalysis = config.UsingStreamRawAnalysis; }
public void SetLMState(NCCConfig.LMMMNetComm config) { State.useAsynch = config.UseAsynchAnalysis; State.includingGen2 = NC.App.AppContext.ParseGen2; State.usingStreamRawAnalysis = config.UsingStreamRawAnalysis; statusCheckCount = NC.App.AppContext.StatusPacketCount; State.InitParseBuffers(config.ParseBufferSize); }