static void Console_LogWrite(System.Diagnostics.TraceLevel level, string message) { if (String.IsNullOrEmpty(message) || level > _consoleLogLevel) { return; } lock (typeof(Console)) { if (level != TraceLevel.Warning && level != TraceLevel.Error) { Console.Out.WriteLine(message); } else { ConsoleColor clr = Console.ForegroundColor; if (level == System.Diagnostics.TraceLevel.Error) { Console.ForegroundColor = ConsoleColor.Red; } else { Console.ForegroundColor = ConsoleColor.Yellow; } Console.Error.WriteLine(message); Console.ForegroundColor = clr; } } }
private void LogMessage(System.Diagnostics.TraceLevel logLevel, string textToLog, string classAndMethod, int threadID) { if (this._DefaultUpdateLogCallback != null) { this._DefaultUpdateLogCallback(logLevel, textToLog, classAndMethod, threadID); } }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="severity"></param> public void Log(string message, System.Diagnostics.TraceLevel severity) { if (m_severityLevel >= severity) { Trace.WriteLine(DateTime.Now.ToString(LOG_TIME_FORMAT) + " " + message + CRLF); } }
/// <summary> /// Sample for skipping directories // <ItemGroup> // <MsDeploySkipRules Include = "SkippingWWWRoot" > // <ObjectName>dirPath</ ObjectName > // <AbsolutePath>wwwroot</ AbsolutePath > // </MsDeploySkipRules> // </ ItemGroup > /// </summary> void IVSMSDeployHost.UpdateDeploymentBaseOptions(VSMSDeployObject srcVsMsDeployobject, VSMSDeployObject destVsMsDeployobject) { Collections.Generic.List <string> enableSkipDirectiveList = MSDeployUtility.ConvertStringIntoList(EnableSkipDirective); Collections.Generic.List <string> disableSkipDirectiveList = MSDeployUtility.ConvertStringIntoList(DisableSkipDirective); VSHostObject hostObject = new VSHostObject(HostObject as System.Collections.Generic.IEnumerable <Framework.ITaskItem>); Framework.ITaskItem[] srcSkipItems, destSkipsItems; // Add FileSkip rules from Host Object hostObject.GetFileSkips(out srcSkipItems, out destSkipsItems); Utility.AddSkipDirectiveToBaseOptions(srcVsMsDeployobject.BaseOptions, srcSkipItems, enableSkipDirectiveList, disableSkipDirectiveList, Log); Utility.AddSkipDirectiveToBaseOptions(destVsMsDeployobject.BaseOptions, destSkipsItems, enableSkipDirectiveList, disableSkipDirectiveList, Log); //Add CustomSkip Rules + AppDataSkipRules GetCustomAndAppDataSkips(out srcSkipItems, out destSkipsItems); Utility.AddSkipDirectiveToBaseOptions(srcVsMsDeployobject.BaseOptions, srcSkipItems, enableSkipDirectiveList, disableSkipDirectiveList, Log); Utility.AddSkipDirectiveToBaseOptions(destVsMsDeployobject.BaseOptions, destSkipsItems, enableSkipDirectiveList, disableSkipDirectiveList, Log); if (!string.IsNullOrEmpty(DeploymentTraceLevel)) { Diagnostics.TraceLevel deploymentTraceEventLevel = (Diagnostics.TraceLevel)System.Enum.Parse(typeof(Diagnostics.TraceLevel), DeploymentTraceLevel, true); srcVsMsDeployobject.BaseOptions.TraceLevel = deploymentTraceEventLevel; destVsMsDeployobject.BaseOptions.TraceLevel = deploymentTraceEventLevel; } Utility.AddSetParametersFilesVsMsDeployObject(srcVsMsDeployobject, ImportSetParametersItems); Utility.AddSimpleSetParametersVsMsDeployObject(srcVsMsDeployobject, SimpleSetParameterItems, OptimisticParameterDefaultValue); Utility.AddSetParametersVsMsDeployObject(srcVsMsDeployobject, SetParameterItems, OptimisticParameterDefaultValue); AddAdditionalProviderOptions(destVsMsDeployobject); }
private static void WriteLog(object message, Exception t, System.Diagnostics.TraceLevel severity, string category) { TraceSwitch ts = new TraceSwitch("nHapi", "nHapi Trace Switch"); bool writeTrace = false; if (ts.Level >= severity) { writeTrace = true; } if (writeTrace) { Exception ex; if (message == null) { ex = t; } else { ex = new Exception(message.ToString(), t); } WriteTrace(ts, ex, category); } }
public static void SetTraceLevel(string name) { string[] trace = name.Split('='); System.Diagnostics.TraceLevel level = System.Diagnostics.TraceLevel.Verbose; if (trace.Length == 2) { level = (System.Diagnostics.TraceLevel)Enum.Parse(typeof(System.Diagnostics.TraceLevel), trace[1], true); } SetTraceLevel(trace[0], level); }
public void Log(System.Diagnostics.TraceLevel level, string message, Exception ex = null) { if (level == System.Diagnostics.TraceLevel.Error) { LogTrace.Error(message, ex); } else { LogTrace.Info(message); } //throw new NotImplementedException(); }
/// <summary> /// This Method will write the Messages to Listners along with Module Name and Method Name /// </summary> /// <param name="severity">Message Severity: Will be used to check whether to log the message or not based on the severity level found in web.Constants</param> /// <param name="methodName">Method Name</param> /// <param name="message">Message String</param> public void Log(System.Diagnostics.TraceLevel severity, string moduleName, string methodName, string message, string stackTrace) { string strLogMessage = ""; if (m_severityLevel >= severity) { Trace.IndentSize = 4; strLogMessage = DateTime.Now.ToString(LOG_TIME_FORMAT) + "|" + String.Format("{0,-7}|{1,-12}|{2,-15}| ", severity, moduleName, methodName) + message + "|" + stackTrace; Trace.WriteLine(strLogMessage); //AppLogTextBox.Text+=strLogMessage+"\r\n"; } }
public static void SetTraceLevel(string name) { #if !WINRT string[] trace = name.Split('='); System.Diagnostics.TraceLevel level = System.Diagnostics.TraceLevel.Verbose; if (trace.Length == 2) { level = (System.Diagnostics.TraceLevel)Enum.Parse(typeof(System.Diagnostics.TraceLevel), trace[1], true); } SetTraceLevel(trace[0], level); #else throw new NotImplementedException(); #endif }
public static bool IsLevelEnabled(System.Diagnostics.TraceLevel level) { switch (level) { case System.Diagnostics.TraceLevel.Error: return(_traceSwitch.TraceError); case System.Diagnostics.TraceLevel.Warning: return(_traceSwitch.TraceWarning); case System.Diagnostics.TraceLevel.Info: return(_traceSwitch.TraceInfo); case System.Diagnostics.TraceLevel.Verbose: return(_traceSwitch.TraceVerbose); } return(false); }
internal static LogLevel ToLogLevel(System.Diagnostics.TraceLevel traceLevel) { switch (traceLevel) { case System.Diagnostics.TraceLevel.Verbose: return(LogLevel.Trace); case System.Diagnostics.TraceLevel.Info: return(LogLevel.Information); case System.Diagnostics.TraceLevel.Warning: return(LogLevel.Warning); case System.Diagnostics.TraceLevel.Error: return(LogLevel.Error); default: return(LogLevel.None); } }
public void ShowMessage(DateTime date, int thread, System.Diagnostics.TraceLevel level, string logger, string message, Exception exception) { if (level == TraceLevel.Error && !ShowErrors) { return; } if (level == TraceLevel.Warning && !ShowWarnings) { return; } if (level == TraceLevel.Info && !ShowInfos) { return; } if (level == TraceLevel.Verbose && !ShowDebug) { return; } traceListView.Invoke(new Action <DateTime, int, System.Diagnostics.TraceLevel, string, string, Exception>(ShowMessageImpl), new object[] { date, thread, level, logger, message, exception }); }
void ShowMessageImpl(DateTime date, int thread, System.Diagnostics.TraceLevel level, string logger, string message, Exception exception) { int rowIndex = GetRowIndex(); ListViewItem lvitem = new ListViewItem(date.ToString()); lvitem.Tag = exception; lvitem.SubItems.Add(thread.ToString()); lvitem.SubItems.Add(level.ToString()); lvitem.SubItems.Add(logger.ToString()); lvitem.SubItems.Add(message.ToString()); if (exception != null) { lvitem.SubItems.Add(exception.Message); } traceListView.Items.Add(lvitem); traceListView.EnsureVisible(rowIndex); ColorizeListViewItem(level, lvitem); }
void IVSMSDeployHost.UpdateDeploymentBaseOptions(VSMSDeployObject srcVsMsDeployobject, VSMSDeployObject destVsMsDeployobject) { Collections.Generic.List <string> enableSkipDirectiveList = MSDeployUtility.ConvertStringIntoList(EnableSkipDirective); Collections.Generic.List <string> disableSkipDirectiveList = MSDeployUtility.ConvertStringIntoList(DisableSkipDirective); MsDeploy.Utility.AddSkipDirectiveToBaseOptions(srcVsMsDeployobject.BaseOptions, null, enableSkipDirectiveList, disableSkipDirectiveList, Log); MsDeploy.Utility.AddSkipDirectiveToBaseOptions(destVsMsDeployobject.BaseOptions, null, enableSkipDirectiveList, disableSkipDirectiveList, Log); if (!string.IsNullOrEmpty(DeploymentTraceLevel)) { Diagnostics.TraceLevel deploymentTraceEventLevel = (Diagnostics.TraceLevel)System.Enum.Parse(typeof(Diagnostics.TraceLevel), DeploymentTraceLevel, true); srcVsMsDeployobject.BaseOptions.TraceLevel = deploymentTraceEventLevel; destVsMsDeployobject.BaseOptions.TraceLevel = deploymentTraceEventLevel; } MsDeploy.Utility.AddSetParametersFilesVsMsDeployObject(srcVsMsDeployobject, ImportSetParametersItems); MsDeploy.Utility.AddSimpleSetParametersVsMsDeployObject(srcVsMsDeployobject, SimpleSetParameterItems, OptimisticParameterDefaultValue); MsDeploy.Utility.AddSetParametersVsMsDeployObject(srcVsMsDeployobject, SetParameterItems, OptimisticParameterDefaultValue); AddAdditionalProviderOptions(destVsMsDeployobject); }
private static void WriteLog(object message, Exception t, System.Diagnostics.TraceLevel severity) { WriteLog(message, t, severity, null); }
/// <summary> /// This Method will write the Messages to Listners along with Module Name and Method Name /// </summary> /// <param name="severity">Message Severity: Will be used to check whether to log the message or not based on the severity level found in web.Constants</param> /// <param name="methodName">Method Name</param> /// <param name="message">Message String</param> public void Log(System.Diagnostics.TraceLevel severity, string moduleName, string methodName, string message) { this.Log(severity, moduleName, methodName, message, ""); }
void Log_LogWrite(System.Reflection.MethodBase method, System.Diagnostics.TraceLevel level, string message) { _lastMessage = message; }
public static void SetLoggingLevel(System.Diagnostics.TraceLevel level) { _tSwitch.Level = level; }
public static void Trace(this WebFarmContext context, System.Diagnostics.TraceLevel level, string format, params object[] args) { context.TraceMessage(new TraceMessage(level, string.Format(format, args))); }
internal static void Bin4gt8pGp([In] System.Diagnostics.TraceLevel level) { }
public static bool IsLevelEnabled(System.Diagnostics.TraceLevel level) { return(true); }
internal static void SetTraceLevel(System.Diagnostics.TraceLevel level) { _traceSwitch.Level = level; }