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;
            }
        }
    }
예제 #2
0
 private void LogMessage(System.Diagnostics.TraceLevel logLevel, string textToLog, string classAndMethod, int threadID)
 {
     if (this._DefaultUpdateLogCallback != null)
     {
         this._DefaultUpdateLogCallback(logLevel, textToLog, classAndMethod, threadID);
     }
 }
예제 #3
0
 /// <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);
     }
 }
예제 #4
0
        /// <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);
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
파일: tracer.cs 프로젝트: labsnap/ikvm-1
 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);
 }
예제 #7
0
 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();
 }
예제 #8
0
        /// <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";
            }
        }
예제 #9
0
        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
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
        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 });
        }
예제 #13
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
 private static void WriteLog(object message, Exception t, System.Diagnostics.TraceLevel severity)
 {
     WriteLog(message, t, severity, null);
 }
예제 #16
0
 /// <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, "");
 }
예제 #17
0
 void Log_LogWrite(System.Reflection.MethodBase method, System.Diagnostics.TraceLevel level, string message)
 {
     _lastMessage = message;
 }
예제 #18
0
 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)));
 }
예제 #20
0
파일: Trace.cs 프로젝트: zhuzhenping/FreeOQ
 internal static void Bin4gt8pGp([In] System.Diagnostics.TraceLevel level)
 {
 }
예제 #21
0
파일: Trace.cs 프로젝트: zhuzhenping/FreeOQ
 public static bool IsLevelEnabled(System.Diagnostics.TraceLevel level)
 {
     return(true);
 }
예제 #22
0
 internal static void SetTraceLevel(System.Diagnostics.TraceLevel level)
 {
     _traceSwitch.Level = level;
 }