当前位置: 首页>>代码示例>>C#>>正文


C# Verbosity.ToString方法代码示例

本文整理汇总了C#中Verbosity.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Verbosity.ToString方法的具体用法?C# Verbosity.ToString怎么用?C# Verbosity.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Verbosity的用法示例。


在下文中一共展示了Verbosity.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Log

 public static void Log(Verbosity verbosity,string format, params object[] arg0)
 {
     if ((int)verbosity >= (int)CurrentVerbosity)
     {
         Console.WriteLine(String.Format("{0}: ", verbosity.ToString()) + format, arg0);
     }
 }
开发者ID:RobertFrydenlund,项目名称:SpotifyPlugin,代码行数:7,代码来源:Out.cs

示例2: Log

 public static void Log(string message, Verbosity verbosity)
 {
     if (!_inUse)
     {
         var directory = AppDomain.CurrentDomain.BaseDirectory + @"\Logs";
         if (!Directory.Exists(directory))
         {
             Directory.CreateDirectory(directory);
         }
         else
         {
             var files = Directory.GetFileSystemEntries(directory).ToList();
             if (files.Count != 0)
             {
                 var obtainedfile = files.LastOrDefault(
                 x => x.Contains("Log_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_"));
                 if (!(String.IsNullOrEmpty(obtainedfile) || String.IsNullOrWhiteSpace(obtainedfile)))
                 {
                     _logFileNumber =
                         Convert.ToInt32(obtainedfile.Substring(obtainedfile.LastIndexOf("_", StringComparison.Ordinal) + 1,
                             obtainedfile.IndexOf(".txt", StringComparison.Ordinal) - (obtainedfile.LastIndexOf("_", StringComparison.Ordinal) + 1)));
                     _logFileNumber++;
                 }
             }
         }
         _inUse = true;
         using (var file = new StreamWriter(@".\Logs\Log_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + _logFileNumber + ".txt"))
         {
             Console.WriteLine(verbosity.ToString("G").ToUpperInvariant() + ": " + DateTime.Now + ": "+ message);
             file.WriteLine(verbosity.ToString("G").ToUpperInvariant() + ": " + DateTime.Now + ": " + message);
         }
     }
     else
     {
         using (var file = File.AppendText(@".\Logs\Log_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + _logFileNumber + ".txt"))
         {
             Console.WriteLine(verbosity.ToString("G").ToUpperInvariant() + ": " + DateTime.Now + ": " + message);
             file.WriteLine(verbosity.ToString("G").ToUpperInvariant() + ": " + DateTime.Now + ": " + message);
         }
     }
 }
开发者ID:Slyther,项目名称:SerpentTheaterServer,代码行数:41,代码来源:BasicLogger.cs

示例3: ToString

 /** ****************************************************************************************
  * Writes a string representation of the \e Verbosity and priority into the given
  * AString.
  *
  * @param verbosity The enum value to retrieve a string representation for.
  * @param priority  The priority of the \p verbosity setting.
  * @param target    The target to write into.
  * @returns \p target to allow concatenated calls.
  ******************************************************************************************/
 public static AString ToString( Verbosity verbosity, int priority, AString target )
 {
     target.Field()._( verbosity.ToString() ).Field( 8, Alignment.Left)
           ._( '(' );
     return ToStringPriority( priority, target )
            .InsertAt( ")", target.LastIndexOfAny( CString.DefaultWhitespaces, Inclusion.Exclude )  + 1 );
 }
开发者ID:AlexWorx,项目名称:ALox-Logging-Library,代码行数:16,代码来源:ALox.cs

示例4: Write

        private static void Write(Verbosity level, string format, params object[] args)
        {
            if (level > Verbosity)
                return;

            string msg = string.Format("{0}, {1,-8}:", DateTime.Now.ToLongTimeString(), level.ToString());

            if (args != null && args.Length > 0)
                msg += string.Format(format, args);
            else
                msg += format;

            foreach (ILogger i in subscribers)
                i.Write(msg);
        }
开发者ID:rikdodsworth,项目名称:tweeta,代码行数:15,代码来源:Log.cs

示例5: Write

 public void Write(LogScope scope, Verbosity verbosity, string source, string text)
 {
     DateTime dt = DateTime.Now;
     string span = "";
     if(scope != null)
          span = (dt - scope.CreateDateTime).ToString();
     TreeIter iter = AppendValues(FindParentIter(scope), dt, (int)verbosity, verbosity.ToString(), text, source, span);
     TreePath path = store.GetPath(iter);
     view.ExpandToPath(path);
     view.ScrollToCell(path, view.Columns[1], false, 0.0f, 0.0f);
 }
开发者ID:langpavel,项目名称:LPS-old,代码行数:11,代码来源:LogWindow.cs


注:本文中的Verbosity.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。