private void WriteLog(string title, string data, TraceType traceType) { string stateAttribute = null; if (this.policy != null && this.policy.CallerInfo != null) { stateAttribute = this.policy.CallerInfo.UserAgent; } ResultSeverityLevel severity = ResultSeverityLevel.Error; if (traceType != TraceType.ErrorTrace || traceType != TraceType.FatalTrace) { severity = ResultSeverityLevel.Informational; } if (traceType == TraceType.FatalTrace || traceType == TraceType.ErrorTrace) { string text = (traceType == TraceType.FatalTrace) ? "Search.FailureMonitor" : "Mailbox.FailureMonitor"; LogItem logItem = new LogItem(ExchangeComponent.EdiscoveryProtocol.Name, text, data, ResultSeverityLevel.Error); logItem.ResultName = string.Format("{0}/{1}", ExchangeComponent.EdiscoveryProtocol.Name, text); logItem.CustomProperties["tenant"] = this.GetTenantDomain(); logItem.Publish(false); return; } LogItem.Publish("EDiscovery", "Reporting", title, data, stateAttribute, severity, false); }
private void AppendFormat <T0, T1>(long id, TraceType type, string formatString, T0 arg0, T1 arg1) { this.builder.BeginEntry(type, this.component, this.tag, id, formatString); this.builder.AddArgument <T0>(arg0); this.builder.AddArgument <T1>(arg1); this.builder.EndEntry(); }
private static void Log(TraceType logEvent, Action <IPecanLogger, string> logStatement) { if (DefaultPecanLogger != null) { logStatement(DefaultPecanLogger, logEvent.ToString()); } }
public TraceLog(TraceType type, MosaMethod method, string stage, bool active) : this(type) { this.Stage = stage; this.Method = method; this.Active = active; }
public TraceLog(TraceType type, MosaMethod method, string stage, TraceFilter filter) : this(type) { this.Stage = stage; this.Method = method; this.Active = filter.IsMatch(this.Method, this.Stage); }
private static unsafe uint TraceInternal(Guid guid, string xml, TraceType type, int eventId) { uint maxValue = uint.MaxValue; if ((Provider != null) && Provider.ShouldTrace) { int num2 = (((xml.Length + 1) * 2) < 0xffce) ? ((xml.Length + 1) * 2) : 0xffce; Mof3Event event2 = new Mof3Event(); event2.Header.Guid = WsatTraceGuid; event2.Header.Type = (byte)type; event2.Header.ClientContext = 0; event2.Header.Flags = 0x120000; event2.Header.BufferSize = 0x60; event2.Mof2.Length = (uint)num2; event2.Mof1.Length = 0x10; event2.Mof1.Data = (IntPtr) & guid; event2.Mof3.Length = 4; event2.Mof3.Data = (IntPtr) & eventId; fixed(char *str = ((char *)xml)) { char *chPtr = str; event2.Mof2.Data = (IntPtr)chPtr; if (Provider != null) { maxValue = provider.Trace((MofEvent *)&event2); } } } return(maxValue); }
public TraceLog(TraceType type, MosaMethod method, string stage, int version = 0) : this(type) { Stage = stage; Method = method; Version = version; }
public IO2Trace addTrace(string traceSignature, TraceType _traceType) { var newTrace = new O2Trace(traceSignature); newTrace.traceType = _traceType; childTraces.Add(newTrace); return newTrace; }
internal static void Trace <T>(TraceType traceType, T obj) { if (obj != null && DDIHelper.HasTraceEnabled(traceType)) { DDIHelper.Trace(traceType, EcpTraceHelper.GetTraceString(obj)); } }
public static O2TraceBlock_OunceV6 getTraceBlockToGlueFinding(AssessmentAssessmentFileFinding fFinding, TraceType ttTraceType, O2AssessmentData_OunceV6 oadO2AssessmentDataOunceV6, Dictionary <String, O2TraceBlock_OunceV6> dO2TraceBlock) { CallInvocation ciCallInvocation = AnalysisSearch.findTraceTypeInSmartTrace_Recursive_returnCallInvocation(fFinding.Trace, ttTraceType); if (ciCallInvocation == null) { return(null); } String sSourceSignature = OzasmtUtils_OunceV6.getStringIndexValue(ciCallInvocation.sig_id, oadO2AssessmentDataOunceV6); String sFile = OzasmtUtils_OunceV6.getFileIndexValue(ciCallInvocation.fn_id, oadO2AssessmentDataOunceV6); String sLineNumber = ciCallInvocation.line_number.ToString(); String sTraceRootText = OzasmtUtils_OunceV6.getStringIndexValue(fFinding.Trace[0].sig_id, oadO2AssessmentDataOunceV6); String sUniqueName = String.Format("{0} {1} {2}", sSourceSignature, sFile, sLineNumber); // need to find a better way to clue the final sinks since at the moment I am getting a couple sinks trown by the cases when a sink also become a source of tainted data //String sUniqueName = String.Format("{0} {1} {2} {3}", sSourceSignature, sFile, sLineNumber, sTraceRootText); if (false == dO2TraceBlock.ContainsKey(sUniqueName)) { dO2TraceBlock.Add(sUniqueName, new O2TraceBlock_OunceV6()); dO2TraceBlock[sUniqueName].sSignature = sSourceSignature; dO2TraceBlock[sUniqueName].sFile = sFile; dO2TraceBlock[sUniqueName].sLineNumber = sLineNumber; dO2TraceBlock[sUniqueName].sTraceRootText = sTraceRootText; dO2TraceBlock[sUniqueName].sUniqueName = sUniqueName; } return(dO2TraceBlock[sUniqueName]); }
/// <summary> /// 標準出力のキャッチ /// </summary> private void process_OutputDataReceived(object sender, DataReceivedEventArgs e) { string line = e.Data; if (string.IsNullOrEmpty(line)) { line = ""; } TraceType traceType = TraceType.Debug; int checkPos = -1; string checkLine = line.ToLower(); if ((checkPos = checkLine.IndexOf(getErrorCatchExePath())) != -1) { //エラー結果を表示する traceType = TraceType.Error; if (line.Length > checkPos + getErrorCatchExePath().Length + 1) { line = line.Substring(checkPos + getErrorCatchExePath().Length + 1).Replace("\"", "") + " : Error: " + m_lastErrorMessage; } } else if (checkLine.IndexOf("error") != -1 || checkLine.IndexOf("エラー") != -1) { traceType = TraceType.Error; m_lastErrorMessage = line; } //出力ウィンドウに表示 TraceManager.AddAsync(line, (int)traceType); }
private void Log(TraceType traceType, string value, params object[] args) { switch (traceType) { case TraceType.Critical: _logger.WriteCritical(String.Format(value, args)); break; case TraceType.Error: _logger.WriteError(String.Format(value, args)); break; case TraceType.Information: _logger.WriteInformation(String.Format(value, args)); break; case TraceType.Verbose: _logger.WriteVerbose(String.Format(value, args)); break; case TraceType.Warning: _logger.WriteWarning(String.Format(value, args)); break; default: break; } }
private static bool IsAnalysis(TraceType type) { switch (type) { case TraceType.WordAnalysis: case TraceType.LexicalLookup: case TraceType.StratumAnalysisInput: case TraceType.StratumAnalysisOutput: case TraceType.TemplateAnalysisInput: case TraceType.TemplateAnalysisOutput: case TraceType.MorphologicalRuleAnalysis: case TraceType.PhonologicalRuleAnalysis: return(true); case TraceType.WordSynthesis: case TraceType.ParseSuccessful: case TraceType.ParseFailed: case TraceType.ParseBlocked: case TraceType.StratumSynthesisInput: case TraceType.StratumSynthesisOutput: case TraceType.TemplateSynthesisInput: case TraceType.TemplateSynthesisOutput: case TraceType.MorphologicalRuleSynthesis: case TraceType.PhonologicalRuleSynthesis: return(false); } return(false); }
static unsafe uint TraceInternal(Guid guid, string xml, TraceType type) { uint result = unchecked ((uint)-1); if (null != Provider && Provider.ShouldTrace) { int dataLength = (xml.Length + 1) * 2 < MaxSupportedStringSize ? (xml.Length + 1) * 2 : MaxSupportedStringSize; Mof2Event evt = new Mof2Event(); evt.Header.Guid = WCFTraceGuid; evt.Header.Type = (byte)type; evt.Header.ClientContext = 0; evt.Header.Flags = WnodeFlags.WnodeFlagTracedGuid | WnodeFlags.WnodeFlagUseMofPointer; evt.Header.BufferSize = (ushort)EtwStructSizes.SizeofEventHeader + 2 * (ushort)EtwStructSizes.SizeofMofField; evt.Mof2.Length = (uint)dataLength; evt.Mof1.Length = 16; evt.Mof1.Data = (IntPtr)(&guid); fixed(char *pdata = xml) { evt.Mof2.Data = (IntPtr)pdata; if (null != Provider) { result = provider.Trace((MofEvent *)&evt); } } } return(result); }
public bool WriteCore(TraceType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) { var messageTemplate = formatter.Invoke(state, exception); switch (eventType) { case TraceType.Critical: Logger.Fatal(messageTemplate); break; case TraceType.Error: Logger.Error(messageTemplate); break; case TraceType.Information: Logger.Information(messageTemplate); break; case TraceType.Verbose: Logger.Verbose(messageTemplate); break; case TraceType.Warning: Logger.Warning(messageTemplate); break; } return true; }
private void TraceEvent(TraceType type, string text) { if (mAudit != null) { mAudit.Write(text); } }
public void Add(TraceType type, string info) { if (IsEnabled) { switch (type) { case TraceType.Error: Console.ForegroundColor = ConsoleColor.Red; break; case TraceType.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case TraceType.Sql: Console.ForegroundColor = ConsoleColor.Magenta; break; case TraceType.Debug: Console.ForegroundColor = ConsoleColor.Blue; break; default: Console.ForegroundColor = ConsoleColor.Green; break; } Console.OutputEncoding = System.Text.Encoding.UTF8; Console.WriteLine($"{type.ToString().ToLower().PadRight(10)}: {info}"); Console.ForegroundColor = ConsoleColor.Gray; } }
public TraceLog(TraceType type, MosaMethod method, string stage, TraceFilter filter) : this(type) { Stage = stage; Method = method; Active = filter.IsMatch(Method, Stage); }
public ServiceFabricRepairManager(CoordinatorEnvironment environment) { //this.activityLogger = activityLogger.Validate("activityLogger"); this.traceType = environment.Validate("environment").CreateTraceType("RMClient"); this.repairManager = this.fabricClient.RepairManager; }
public TraceElement(TraceType t, UInt16 line, byte[] d, string f) { type = t; lineNumber = line; data = d; fileName = f; }
public static bool WriteBinary(TraceType traceType, Guid component, int traceTag, byte[] message, out int maxBytes) { maxBytes = 0; int num = message.Length; if (traceTag > 255) { throw new ArgumentException("Maximum allowed tag-value is 255 for binary traces", "traceTag"); } if (num > 8064) { maxBytes = 8064; return(false); } GCHandle?gchandle = null; uint num2 = 0U; try { DiagnosticsNativeMethods.BinaryEventTrace binaryEventTrace = new DiagnosticsNativeMethods.BinaryEventTrace(component, (byte)traceTag, message, ref gchandle); num2 = DiagnosticsNativeMethods.TraceEvent(ETWTrace.ComponentSession.Session.DangerousGetHandle(), ref binaryEventTrace); } finally { if (gchandle != null && gchandle.Value.IsAllocated) { gchandle.Value.Free(); } } return(num2 == 0U); }
public static List <String> getListOf_TraceSignatures_ByTraceType(String sPathToSavedXmlFile, TraceType ttTraceType, ref O2AssessmentData_OunceV6 fadO2AssessmentDataOunceV6) { var lsMatches = new List <string>(); bool bVerbose = false; if (fadO2AssessmentDataOunceV6 == null) { Analysis.loadAssessmentFile(sPathToSavedXmlFile, bVerbose, ref fadO2AssessmentDataOunceV6); } if (null != fadO2AssessmentDataOunceV6.arAssessmentRun.Assessment.Assessment) { foreach (Assessment aAssessment in fadO2AssessmentDataOunceV6.arAssessmentRun.Assessment.Assessment) { foreach (AssessmentAssessmentFile afAssessmentFile in aAssessment.AssessmentFile) { if (null != afAssessmentFile.Finding) { foreach (AssessmentAssessmentFileFinding aaffFinding in afAssessmentFile.Finding) { String sSignature = Analysis.getSmartTraceNameOfTraceType(aaffFinding.Trace, ttTraceType, fadO2AssessmentDataOunceV6); if (sSignature != "" && false == lsMatches.Contains(sSignature)) { lsMatches.Add(sSignature); } } } } } } return(lsMatches); }
/// <summary> /// Initializes a new instance of the <see cref="Trace"/> class. /// </summary> internal Trace(TraceType type, IHCRule source) : base(begin => new Trace(TraceType.None, null)) { _type = type; _source = source; SubruleIndex = -1; }
// Token: 0x0600004C RID: 76 RVA: 0x00004310 File Offset: 0x00002510 public static void Trace(long id, TraceType traceType, params object[] parameters) { if (ComplianceProtocolLog.GetInstance() == null) { return; } if (parameters != null && parameters.Length > 0 && ExTraceGlobals.TaskDistributionSystemTracer.IsTraceEnabled(traceType)) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < parameters.Length; i++) { stringBuilder.AppendFormat("{{{0}}}", i); } string formatString = stringBuilder.ToString(); switch (traceType) { case TraceType.DebugTrace: ExTraceGlobals.TaskDistributionSystemTracer.TraceDebug(id, formatString, parameters); return; case TraceType.WarningTrace: ExTraceGlobals.TaskDistributionSystemTracer.TraceWarning(id, formatString, parameters); return; case TraceType.ErrorTrace: ExTraceGlobals.TaskDistributionSystemTracer.TraceError(id, formatString, parameters); return; case TraceType.PerformanceTrace: ExTraceGlobals.TaskDistributionSystemTracer.TracePerformance(id, formatString, parameters); return; } ExTraceGlobals.TaskDistributionSystemTracer.Information(id, formatString, parameters); } }
public TraceLog(TraceType type, MosaMethod method, string stage, bool active) : this(type) { Stage = stage; Method = method; Active = active; }
static WSTrace() { WS_LogsFilePath = @"C:\WS_Trace\"; traceFileName = "Trace.txt"; auditFileName = "Audit.txt"; traceType = TraceType.Both; }
public static Color GetColor(TraceType type) { Color color = Color.White; switch (type) { case TraceType.Error: color = Color.Red; break; case TraceType.Warning: color = Color.Yellow; break; case TraceType.Info: color = Color.LimeGreen; break; case TraceType.Debug: color = Color.LightGray; break; default: color = Color.White; break; } return(color); }
public static List <String> getListOf_KnownSinks(String sPathToSavedXmlFile, ref O2AssessmentData_OunceV6 fadO2AssessmentDataOunceV6) { TraceType ttTraceType = TraceType.Known_Sink; return(getListOf_TraceSignatures_ByTraceType(sPathToSavedXmlFile, ttTraceType, ref fadO2AssessmentDataOunceV6)); }
private static unsafe uint TraceInternal(Guid guid, string xml, TraceType type, int eventId) { uint maxValue = uint.MaxValue; if ((Provider != null) && Provider.ShouldTrace) { int num2 = (((xml.Length + 1) * 2) < 0xffce) ? ((xml.Length + 1) * 2) : 0xffce; Mof3Event event2 = new Mof3Event(); event2.Header.Guid = WsatTraceGuid; event2.Header.Type = (byte) type; event2.Header.ClientContext = 0; event2.Header.Flags = 0x120000; event2.Header.BufferSize = 0x60; event2.Mof2.Length = (uint) num2; event2.Mof1.Length = 0x10; event2.Mof1.Data = (IntPtr) &guid; event2.Mof3.Length = 4; event2.Mof3.Data = (IntPtr) &eventId; fixed (char* str = ((char*) xml)) { char* chPtr = str; event2.Mof2.Data = (IntPtr) chPtr; if (Provider != null) { maxValue = provider.Trace((MofEvent*) &event2); } } } return maxValue; }
protected bool ReadTraceTypes(string line, ref BitArray traceTypes) { for (;;) { bool flag = false; string nextLexem = this.GetNextLexem(ref line, ref flag); if (flag) { break; } if (string.IsNullOrEmpty(nextLexem)) { return(true); } if (!(nextLexem == ",")) { if (nextLexem == ":") { goto Block_3; } TraceType traceTypeByName = this.GetTraceTypeByName(nextLexem); if (traceTypeByName != TraceType.None) { traceTypes[(int)traceTypeByName] = true; } } } this.ReportError("Low level scanning error in the trace types statement.", new object[0]); return(false); Block_3: this.ReportError("Bogus colon in the trace types statement.", new object[0]); return(false); }
/// <summary> /// Initializes a new instance of the <see cref="TraceElement"/> class. /// </summary> /// <param name="t">The t.</param> /// <param name="line">The line.</param> /// <param name="d">The d.</param> /// <param name="f">The f.</param> public TraceElement() { type = TraceType.UNKNOWN; lineNumber = 0; data = new byte[0]; fileName = ""; }
public static void Write(EtwSessionInfo sessionInfo, int lid, TraceType traceType, Guid component, int traceTag, long id, string message) { int num = (message.Length + 1) * 2; int num2 = 16; int num3 = 8064; int val = (num3 - num2) / 2 - 1; if (num2 + num < num3) { uint num4 = DiagnosticsNativeMethods.TraceMessage(sessionInfo.Session.DangerousGetHandle(), 43U, ref component, (ushort)traceType | 32, ref traceTag, 4, message, num, ref id, 8, ref lid, 4, IntPtr.Zero, 0); if (num4 != 0U) { return; } } else { int num5 = 0; int i = message.Length; while (i > 0) { int num6 = Math.Min(i, val); uint num7 = DiagnosticsNativeMethods.TraceMessage(sessionInfo.Session.DangerousGetHandle(), 43U, ref component, (ushort)traceType | 32, ref traceTag, 4, message.Substring(num5, num6), (num6 + 1) * 2, ref id, 8, ref lid, 4, IntPtr.Zero, 0); i -= num6; num5 += num6; } } }
public static async Task ExecuteActionsAsync( Guid activityId, TraceType traceType, IList <IAction> actions) { traceType.Validate("traceType"); actions.Validate("actions"); var exceptions = new List <Exception>(); foreach (var action in actions) { try { traceType.WriteInfo("{0} Start: {1}", activityId, action); await action.ExecuteAsync(activityId).ConfigureAwait(false); traceType.WriteInfo("{0} Finish: {1}", activityId, action); } catch (Exception ex) { traceType.WriteWarning("{0} Error: {1}{2}Exception: {3}", activityId, action, Environment.NewLine, ex); exceptions.Add(ex); } } if (exceptions.Count > 0) { throw new AggregateException(exceptions); } }
public PolicyAgentServiceWrapper(CoordinatorEnvironment environment, IActivityLogger activityLogger, Uri zeroSdkUri = null, bool silentErrors = false) { this.traceType = environment.Validate("environment").CreateTraceType("ZeroSdkClient"); this.activityLogger = activityLogger.Validate("activityLogger"); this.traceWriteConditionalWarning = silentErrors ? new WriteTraceDelegate(traceType.WriteInfo) : new WriteTraceDelegate(traceType.WriteWarning); this.zeroSdkUri = zeroSdkUri ?? GetMRZeroSdkUri(environment.Config); }
public AzureParallelDisabledCoordinator( CoordinatorEnvironment environment, string tenantId, Func <Task <IPolicyAgentClient> > policyAgentClientAsyncFactory, IRepairManager repairManager, IHealthClient healthClient, IActivityLogger activityLogger, Guid partitionId, long replicaId) { this.environment = environment.Validate("environment"); this.tenantId = tenantId.Validate("tenantId"); this.partitionId = partitionId; this.policyAgentClientAsyncFactory = policyAgentClientAsyncFactory.Validate("policyAgentClientAsyncFactory"); this.traceType = environment.CreateTraceType("DisabledCoordinator"); this.repairManager = repairManager.Validate("repairManager"); this.healthClient = healthClient.Validate("healthClient"); this.configSection = environment.Config; this.activityLogger = activityLogger.Validate("activityLogger"); var assembly = this.GetType().GetTypeInfo().Assembly; assemblyFileVersion = FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion; }
public TraceLog(TraceType type, MosaMethod method, string stage, string section, bool active) : this(type) { Stage = stage; Section = section; Method = method; Active = active; }
/// <summary> /// Checks if the given TraceEventType is enabled. /// </summary> /// <param name="logger"></param> /// <param name="eventType"></param> /// <returns></returns> public static bool IsEnabled(this ILogger logger, TraceType eventType) { if (logger == null) { throw new ArgumentNullException("logger"); } return logger.WriteCore(eventType, 0, null, null, null); }
public void Add(TraceType type, string title, string description, string content) { var entry = new TraceEntry { Type = type, Title = title, Description = description, Content = content }; Add(entry); }
public List<IO2Trace> addTraces(string prefixText, TraceType _traceType, params string[] traceSignatures) { var newTraces = new List<IO2Trace>(); foreach (var traceSignature in traceSignatures) { var newTrace = new O2Trace(prefixText + traceSignature); newTrace.traceType = _traceType; childTraces.Add(newTrace); newTraces.Add(newTrace); } return newTraces; }
public bool WriteCore(TraceType traceType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) { var eventType = (TraceEventType)traceType; if (!_traceSource.Switch.ShouldTrace(eventType)) { return false; } else if (formatter != null) { _traceSource.TraceEvent(eventType, eventId, formatter(state, exception)); } return true; }
public bool WriteCore(TraceType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) { _sink.Write(new WriteCoreContext() { EventType = eventType, EventId = eventId, State = state, Exception = exception, Formatter = formatter, LoggerName = _name, Scope = _scope }); return true; }
public static IO2Trace getTraceType(List<IO2Trace> o2Traces, TraceType traceType) { foreach (IO2Trace o2Trace in o2Traces) { if (o2Trace.traceType == traceType) return o2Trace; if (o2Trace.childTraces != null) //foreach (O2Trace childO2Trace in o2Trace.childTraces) { IO2Trace result = getTraceType(o2Trace.childTraces, traceType); if (null != result) return result; } } return null; }
public static bool doesIdExistInSmartTraceCall_Recursive(CallInvocation[] cCallInvocations, UInt32 uSmartTraceCallID, TraceType tTraceType) { foreach (CallInvocation cCallInvocation in cCallInvocations) { if (cCallInvocation.sig_id == uSmartTraceCallID && cCallInvocation.trace_type == (int) tTraceType) return true; if (null != cCallInvocation.CallInvocation1) { bool bResult = doesIdExistInSmartTraceCall_Recursive(cCallInvocation.CallInvocation1, uSmartTraceCallID, tTraceType); if (bResult) return bResult; } } return false; }
public bool WriteCore( TraceType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) { if (formatter != null) { var message = formatter(state, exception); if (!string.IsNullOrWhiteSpace(message)) { lock (_logFilePath) { File.AppendAllText(_logFilePath, message + "\r\n"); } } } return true; }
public bool WriteCore( TraceType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) { if (eventId == RelationalLoggingEventIds.Sql) { var sql = formatter(state, exception); _sqlStatements.Add(sql); //Trace.WriteLine(sql); } return true; }
private static string GetTraceTypeString(TraceType type) { switch (type) { case TraceType.WordAnalysis: return "Word Analysis"; case TraceType.WordSynthesis: return "Word Synthesis"; case TraceType.ParseSuccessful: return "Successful Parse"; case TraceType.ParseFailed: return "Failed Parse"; case TraceType.ParseBlocked: return "Blocked Parse"; case TraceType.LexicalLookup: return "Lexical Lookup"; case TraceType.StratumAnalysisInput: return "Stratum Analysis In"; case TraceType.StratumAnalysisOutput: return "Stratum Analysis Out"; case TraceType.StratumSynthesisInput: return "Stratum Synthesis In"; case TraceType.StratumSynthesisOutput: return "Stratum Synthesis Out"; case TraceType.TemplateAnalysisInput: return "Template Analysis In"; case TraceType.TemplateAnalysisOutput: return "Template Analysis Out"; case TraceType.TemplateSynthesisInput: return "Template Synthesis In"; case TraceType.TemplateSynthesisOutput: return "Template Synthesis Out"; case TraceType.MorphologicalRuleAnalysis: return "Morphological Rule Analysis"; case TraceType.MorphologicalRuleSynthesis: return "Morphological Rule Synthesis"; case TraceType.PhonologicalRuleAnalysis: return "Phonological Rule Analysis"; case TraceType.PhonologicalRuleSynthesis: return "Phonological Rule Synthesis"; } return null; }
public static void DebugTrace(TraceType type, string msg) { StackTrace st = new StackTrace(true); StackFrame sf = st.GetFrame(1); string typeStr = ""; switch (type) { case TraceType.Info: typeStr = "Info"; break; case TraceType.Error: typeStr = "Err"; break; case TraceType.Exception: typeStr = "Exception"; break; } Trace.WriteLine(String.Format("{0, -9} : {1} {2}:{3} {4}", typeStr, msg, sf.GetMethod().Name, sf.GetFileName(), sf.GetFileLineNumber())); }
public static List<String> getListOf_TraceSignatures_ByTraceType(String sPathToSavedXmlFile, TraceType ttTraceType, ref O2AssessmentData_OunceV6 fadO2AssessmentDataOunceV6) { var lsMatches = new List<string>(); bool bVerbose = false; if (fadO2AssessmentDataOunceV6 == null) Analysis.loadAssessmentFile(sPathToSavedXmlFile, bVerbose, ref fadO2AssessmentDataOunceV6); if (null != fadO2AssessmentDataOunceV6.arAssessmentRun.Assessment.Assessment) foreach (Assessment aAssessment in fadO2AssessmentDataOunceV6.arAssessmentRun.Assessment.Assessment) foreach (AssessmentAssessmentFile afAssessmentFile in aAssessment.AssessmentFile) if (null != afAssessmentFile.Finding) foreach (AssessmentAssessmentFileFinding aaffFinding in afAssessmentFile.Finding) { String sSignature = Analysis.getSmartTraceNameOfTraceType(aaffFinding.Trace, ttTraceType, fadO2AssessmentDataOunceV6); if (sSignature != "" && false == lsMatches.Contains(sSignature)) lsMatches.Add(sSignature); } return lsMatches; }
/// <summary> /// (recursive call) returns a direct path between the found traceType and the first o2trace provided in o2Traces /// </summary> /// <param name="o2Traces"></param> /// <param name="traceType"></param> /// <param name="pathToTraceType"></param> /// <returns></returns> public static bool getPathToTraceType(List<IO2Trace> o2Traces, TraceType traceType, List<IO2Trace> pathToTraceType) { foreach (IO2Trace o2Trace in o2Traces) { if (o2Trace.traceType == traceType) { pathToTraceType.Add(o2Trace); return true; } if (o2Trace.childTraces != null) { if (getPathToTraceType(o2Trace.childTraces, traceType, pathToTraceType)) { pathToTraceType.Add(o2Trace); return true; } } } return false; }
protected TraceLog(TraceType type) { this.Type = type; this.Active = true; this.Lines = new List<string>(); }
public bool WriteCore(TraceType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) { return false; }
public O2Trace(String clazz, String method, TraceType traceType) : this(clazz, method) { this.traceType = traceType; }
public O2Trace(String clazz, TraceType traceType) : this(clazz) { this.traceType = traceType; }
internal static O2RuleType getO2RuleTypeFromRuleType(TraceType traceType) { switch (traceType) { case TraceType.Known_Sink: return O2RuleType.Sink; case TraceType.Lost_Sink: return O2RuleType.LostSink; case TraceType.Source: return O2RuleType.Source; default: return O2RuleType.NotMapped; } }
static unsafe uint TraceInternal(Guid guid, string xml, TraceType type) { uint result = unchecked((uint)-1); if (null != Provider && Provider.ShouldTrace) { int dataLength = (xml.Length + 1) * 2 < MaxSupportedStringSize ? (xml.Length + 1) * 2 : MaxSupportedStringSize; Mof2Event evt = new Mof2Event(); evt.Header.Guid = WCFTraceGuid; evt.Header.Type = (byte)type; evt.Header.ClientContext = 0; evt.Header.Flags = WnodeFlags.WnodeFlagTracedGuid | WnodeFlags.WnodeFlagUseMofPointer; evt.Header.BufferSize = (ushort)EtwStructSizes.SizeofEventHeader + 2 * (ushort)EtwStructSizes.SizeofMofField; evt.Mof2.Length = (uint)dataLength; evt.Mof1.Length = 16; evt.Mof1.Data = (IntPtr)(&guid); fixed (char* pdata = xml) { evt.Mof2.Data = (IntPtr)pdata; if (null != Provider) { result = provider.Trace((MofEvent*)&evt); } } } return result; }
private static bool IsAnalysis(TraceType type) { switch (type) { case TraceType.WordAnalysis: case TraceType.LexicalLookup: case TraceType.StratumAnalysisInput: case TraceType.StratumAnalysisOutput: case TraceType.TemplateAnalysisInput: case TraceType.TemplateAnalysisOutput: case TraceType.MorphologicalRuleAnalysis: case TraceType.PhonologicalRuleAnalysis: return true; case TraceType.WordSynthesis: case TraceType.ParseSuccessful: case TraceType.ParseFailed: case TraceType.ParseBlocked: case TraceType.StratumSynthesisInput: case TraceType.StratumSynthesisOutput: case TraceType.TemplateSynthesisInput: case TraceType.TemplateSynthesisOutput: case TraceType.MorphologicalRuleSynthesis: case TraceType.PhonologicalRuleSynthesis: return false; } return false; }
//rename this method since we do more than just Source or Sinks here private static void updateSourceOrSinkRule(O2RulePack o2RulePack,IDictionary<string, List<IO2Rule>> indexedO2Rules, string ruleSignature, string languageDBId, TraceType traceType) { if (indexedO2Rules != null && ruleSignature != null) { //bool createNotMappedRule = false; var createRuleWithType = O2RuleType.NotMapped; // only proccess Sources, Sinks and Lost Sinks if (traceType == TraceType.Source || traceType == TraceType.Known_Sink || traceType == TraceType.Lost_Sink) { O2RuleType o2NewRuleType = O2RulePackUtils.getO2RuleTypeFromRuleType(traceType); createRuleWithType = o2NewRuleType; /* if (indexedO2Rules != null && false == string.IsNullOrEmpty(ruleSignature)) if (indexedO2Rules.ContainsKey(ruleSignature)) { bool thereIsAlreadyARuleWithTheSameRuleType = false; foreach (var o2Rule in indexedO2Rules[ruleSignature]) { if (o2Rule.RuleType == O2RuleType.NotMapped) // if it is not mapped change it to o2NewRuleType { o2Rule.RuleType = o2NewRuleType; return; } if (o2Rule.RuleType == o2NewRuleType) // if it is already a rule of type o2NewRuleType, mark it so we can ignore it below thereIsAlreadyARuleWithTheSameRuleType = true; } if (false == thereIsAlreadyARuleWithTheSameRuleType) // if we got this far, create a new rule of o2NewRuleType { var newRule = O2RulePackUtils.createRule(o2NewRuleType, ruleSignature, languageDBId); indexedO2Rules[ruleSignature].Add(newRule); // add it to the index so that we don't have to calculate it again o2RulePack.o2Rules.Add(newRule); } } */ } bool createNewRule = true; IO2Rule notMappedRule = null; if (indexedO2Rules.ContainsKey(ruleSignature)) { foreach (var o2Rule in indexedO2Rules[ruleSignature]) { if (o2Rule.RuleType == createRuleWithType) // dont create if there is already a rule of this type { o2Rule.Tagged = true; createNewRule = false; } if (o2Rule.RuleType == O2RuleType.NotMapped) notMappedRule = o2Rule; } } // handle the case where we have already added a signature but it is not a NotMapped one if (createRuleWithType == O2RuleType.NotMapped && createNewRule && notMappedRule == null && indexedO2Rules.ContainsKey(ruleSignature)) createNewRule = false; // if required, Create rule if (createNewRule) { var vulnType = "O2.FindingRule." + createRuleWithType.ToString(); var newRule = new O2Rule(createRuleWithType,vulnType, ruleSignature, languageDBId,true); o2RulePack.o2Rules.Add(newRule); if (false == indexedO2Rules.ContainsKey(ruleSignature)) indexedO2Rules.Add(ruleSignature, new List<IO2Rule>()); indexedO2Rules[ruleSignature].Add(newRule); if (notMappedRule != null) indexedO2Rules[ruleSignature].Remove(notMappedRule); } } }
internal static void Trace(string xml, TraceType type) { TraceInternal(EtwTrace.GetActivityId(), xml, type); }