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


C# LogAction.ToString方法代码示例

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


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

示例1: Write

 public static void Write(LogAction action, string dir, string msg)
 {
     if ((LogConfig.LogType & (int)action) != 0)
     {
         string key = logPrex + dir + "\\" + action.ToString();
         PushLog(key, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\t" + msg);
     }
 }
开发者ID:kcitwm,项目名称:dova,代码行数:8,代码来源:Log.cs

示例2: WriteNoTime

 public static void WriteNoTime(LogAction action, string dir, string msg)
 {
     if ((LogConfig.LogType & (int)action) != 0)
     {
         string key = action.ToString() + "\\" + dir;
         if (tempDirs.IndexOf(key + ",") == -1)
         {
             tempDirs += key + ",";
             //logs[key] = new StringBuilder(); ;
         }
         PushLog(key, msg);
     }
 }
开发者ID:kcitwm,项目名称:dova,代码行数:13,代码来源:Log.cs

示例3: LogActivity

	/// <summary>
	/// Generate a standard log entry line
	/// </summary>
	/// <param name="action">action identifier</param>
	/// <param name="username">user</param>
	/// <param name="target">target informatio for action</param>
	public void LogActivity(LogAction action, string username, string target = "", string msg = "")
	{

		// build a string containing the log entry
		StringBuilder sb = new StringBuilder();
		
		// capture the timestamp and add as the first column
		sb.Append(timestamp.ToShortDateString() + " " + timestamp.ToShortTimeString() + LogSeparator);

		// add the ip address
		sb.Append( HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] + LogSeparator );

		// add the current user
		sb.Append( username + LogSeparator );

		// add the action
		sb.Append( action.ToString() + LogSeparator );

		// add the target information
		sb.Append( target + LogSeparator );

		// add the message
		sb.Append(msg + LogSeparator);

		// add the entry to the log file
		LogAppend(sb.ToString());
	}
开发者ID:sancsoft,项目名称:FileZilla.NET,代码行数:33,代码来源:ActivityLog.cs

示例4: writeXmlLog

        // http://www.tkachenko.com/blog/archives/000053.html
        // http://www.codeproject.com/KB/XML/XmlAppending.aspx
        private static void writeXmlLog(Mission mission, LogAction logAction)
        {
            if (!File.Exists(LOG_FILE))
            {
                XmlTextWriter textWritter = new XmlTextWriter(LOG_FILE, Encoding.Unicode);
                textWritter.WriteStartElement(LogXmlTag.Missions.ToString());
                textWritter.WriteEndElement();
                textWritter.Close();
            }

            DateTime dateTime = DateTime.Now;
            XmlDocument xmlDoc=new XmlDocument();
            xmlDoc.Load(LOG_FILE);

            // TODO: Prune old entries

            XmlElement subRoot = xmlDoc.CreateElement(LogXmlTag.Mission.ToString());
            subRoot.SetAttribute(LogXmlTag.Date.ToString(), dateTime.ToString("yyyy/MM/dd"));
            subRoot.SetAttribute(LogXmlTag.Time.ToString(), dateTime.ToString("HH:mm:ss"));
            subRoot.SetAttribute(LogXmlTag.Action.ToString(), logAction.ToString());
            subRoot.SetAttribute(LogXmlTag.Id.ToString(), mission.getId());
            subRoot.SetAttribute(LogXmlTag.Name.ToString(), mission.getName());
            subRoot.SetAttribute(LogXmlTag.Type.ToString(), mission.getType().ToString());
            subRoot.SetAttribute(LogXmlTag.Key.ToString(), mission.getKey());
            XmlText xmlTextMission = xmlDoc.CreateTextNode(mission.getXML());
            subRoot.AppendChild(xmlTextMission);
            xmlDoc.DocumentElement.AppendChild(subRoot);

            /*XmlTextWriter writer = new XmlTextWriter(LOG_FILE, Encoding.Unicode);
            writer.Formatting = Formatting.Indented;
            writer.Indentation = 3;
            xmlDoc.Save(writer);*/
            xmlDoc.Save(LOG_FILE);
        }
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:36,代码来源:Database.cs


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