• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LogAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MyServiceBase

 public MyServiceBase(string name, MainAction ma, LogAction la)
 {
     // InitializeComponent
     this.ServiceName = name;
     this.CbMain = ma;
     this.CbLog = la;
 }
开发者ID:adamcadd,项目名称:zoneedit-dyndns-client,代码行数:7,代码来源:MyServiceBase.cs


示例2: ParseWord

 internal static void ParseWord(XDocument document, LogAction func)
 {
     XElement WordNode = new XElement("Word");
     (document.FirstNode as XElement).Add(WordNode);
     ParseWordTypes(WordNode, func);
     ParseWordEnums(WordNode, func);
     ParseWordTypesMembers(WordNode, func);
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:8,代码来源:Parser.cs


示例3: DelegateLogger

        /// <summary>
        /// Initializes a new instance of the <see cref="LoggerBase" /> class.
        /// </summary>
        /// <param name="action">The action to use.</param>
        /// <param name="syncRoot">The custom object for thread safe operations.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="action" /> is <see langword="null" />.
        /// </exception>
        public DelegateLogger(LogAction action, object syncRoot = null)
            : base(syncRoot: syncRoot)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            _ACTION = action;
        }
开发者ID:mkloubert,项目名称:Diagnostics.NET,代码行数:18,代码来源:DelegateLogger.cs


示例4: LogEntry

        /// <summary>
        /// Log object constructor.
        /// </summary>
        /// <param name="type">The type of the event being logged.</param>
        /// <param name="function">The function executing when the event occured.</param>
        /// <param name="action">The action being performed when the event occured.</param>
        /// <param name="Message">A specific message associated with the event being logged.</param>
        /// <param name="user">The user of the system when the event occured.</param>
        /// <param name="timestamp">The date and time when the event was logged (set in DB).</param>
        public LogEntry(LogType type, LogFunction function, LogAction action, DateTime timestamp, long id, string message, Person user)
        {
            Type = type;
            Function = function;
            Action = action;

            ID = id;
            Timestamp = timestamp;
            Message = message;
            User = user;
        }
开发者ID:kjlahm,项目名称:Dugout-Digits,代码行数:20,代码来源:LogEntry.cs


示例5: SearchAndReplace

        /// <summary>
        /// Read all files in a directory and replace arg search with arg replace in file content(s)
        /// </summary>
        /// <param name="directoryName">target root directory</param>
        /// <param name="fileFilter">exclude filter as file extension</param>
        /// <param name="search">search expression</param>
        /// <param name="replace">replace value</param>
        /// <param name="func">log handler</param>
        public static void SearchAndReplace(string directoryName, string fileFilter, string search, string replace, LogAction func)
        {
            if (!Directory.Exists(directoryName))
                throw new DirectoryNotFoundException(directoryName);
            if (null == func || String.IsNullOrWhiteSpace(replace) || String.IsNullOrWhiteSpace(search) || String.IsNullOrWhiteSpace(fileFilter) || String.IsNullOrWhiteSpace(directoryName))
                throw new ArgumentNullException();

            string[] filterArray = BuildFilterArray(fileFilter);
            string[] searchArray = BuildSearchArray(search);
            string[] replaceArray = BuildReplaceArray(replace);
            if (searchArray.Length != replaceArray.Length)
                throw new FormatException("Search and Repleace terms count must equal");
            SearchAndReplace(directoryName, filterArray, searchArray, replaceArray, func);
        }
开发者ID:swatt6400,项目名称:NetOffice,代码行数:22,代码来源:SearchAndReplaceManager.cs


示例6: ParseReference

        internal static XDocument ParseReference(LogAction func)
        {
            func("Parse References ");
            XDocument document = new XDocument();
            document.Add(new XElement("NOBuildTools.ReferenceAnalyzer"));
            ParseExcel(document, func);
            ParseAccess(document, func);
            ParseOffice(document, func);
            ParseOutlook(document, func);
            ParsePowerPoint(document, func);
            ParseProject(document, func);
            ParseVisio(document, func);
            ParseWord(document, func);
            func("Done!");

            return document;
        }
开发者ID:netintellect,项目名称:NetOffice,代码行数:17,代码来源:Parser.cs


示例7: ParseWordTypes

        private static void ParseWordTypes(XElement excelNode, LogAction func)
        {
            func("Parse Word Types");

            XElement rootNode = new XElement("Types");
            excelNode.Add(rootNode);

            int counter = 0;
            string excelRootReferencePage = _rootAdress + _wordTypesRelative;
            using (var client = new System.Net.WebClient())
            {
                string pageContent = DownloadPage(client, excelRootReferencePage);
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(pageContent);
                var root = doc.DocumentNode;

                var divNodes = root.Descendants("div").ToList();
                foreach (var item in divNodes)
                {
                    string className = item.GetAttributeValue("class", null);
                    if (className == "toclevel2")
                    {
                        string href = item.FirstChild.NextSibling.GetAttributeValue("href", null);
                        string name = item.FirstChild.NextSibling.GetAttributeValue("title", null);
                        if (null != href && null != name)
                        {
                            if (name.EndsWith(" Object", StringComparison.InvariantCultureIgnoreCase))
                            {
                                name = name.Substring(0, name.Length - " Object".Length);
                                rootNode.Add(new XElement("Type", new XElement("Name", name), new XElement("Link", _rootAdress + href)));
                                counter++;
                            }
                        }
                    }

                }
            }

            func(String.Format("{0} Word Types recieved", counter));
        }
开发者ID:netintellect,项目名称:NetOffice,代码行数:40,代码来源:Parser.cs


示例8: DoSearchAndReplace

        private static bool DoSearchAndReplace(ref string fileContent, string[] searchArray, string[] replaceArray, LogAction func)
        {
            bool oneOrMoreReplaced = false;
            for (int i = 0; i < searchArray.Length; i++)
            {
                string search = searchArray[i];
                string replace = replaceArray[i];
                int cnt = 0;
                while (fileContent.IndexOf(search) > -1)
                {
                    fileContent = fileContent.Replace(search, replace);
                    cnt++;
                }
                if (cnt > 0)
                {
                    oneOrMoreReplaced = true;
                    func(String.Format("{0} entries of {1} replaced", cnt, search));
                }

            }

            return oneOrMoreReplaced;
        }
开发者ID:netintellect,项目名称:NetOffice,代码行数:23,代码来源:SearchAndReplaceManager.cs


示例9: DataAdjusterWithLogging

 public DataAdjusterWithLogging(IBuildRepository repository, LogAction log) : base(repository)
 {
     OnFoundInvalidData = data => log("-- Found invalid json-data in file: {0}", data.Source);
     OnFixedInvalidData = () => log("-- Successfully converted invalid json data to valid");
     OnCouldNotConvertData = e => log("-- Could not convert json-data : {0}", e.Message);
 }
开发者ID:abhijeetpathak,项目名称:BuildMonitor,代码行数:6,代码来源:DataAdjusterWithLogging.cs


示例10: ParsePowerPointTypeEvents

 private static void ParsePowerPointTypeEvents(XElement propertiesNode, LogAction func)
 {
     using (var client = new System.Net.WebClient())
     {
         string pageLink = XmlConvert.DecodeName(propertiesNode.Attribute("Link").Value);
         string pageContent = DownloadPage(client, pageLink);
         HtmlDocument doc = new HtmlDocument();
         doc.LoadHtml(pageContent);
         var root = doc.DocumentNode;
         var divNodes = root.Descendants("div").ToList();
         foreach (var item in divNodes)
         {
             string className = item.GetAttributeValue("class", null);
             if (className == "toclevel2")
             {
                 string href = item.FirstChild.NextSibling.GetAttributeValue("href", null);
                 string name = item.FirstChild.NextSibling.GetAttributeValue("title", null);
                 if (null != href && null != name)
                 {
                     if (name.IndexOf(" ") > -1)
                         name = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0];
                     propertiesNode.Add(new XElement("Event", new XElement("Name", name), new XElement("Link", _rootAdress + href)));
                     func("");
                 }
             }
         }
     }
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:28,代码来源:Parser.cs


示例11: ParsePowerPointTypeMembers

        private static void ParsePowerPointTypeMembers(XElement typeNode, LogAction func)
        {
            XElement propsNode = new XElement("Properties");
            XElement methodsNode = new XElement("Methods");
            XElement eventsNode = new XElement("Events");
            typeNode.Add(propsNode);
            typeNode.Add(methodsNode);
            typeNode.Add(eventsNode);

            using (var client = new System.Net.WebClient())
            {
                string pageLink = typeNode.Element("Link").Value;
                string pageContent = DownloadPage(client, pageLink);
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(pageContent);
                var root = doc.DocumentNode;

                var divNodes = root.Descendants("div").ToList();
                foreach (var item in divNodes)
                {
                    string className = item.GetAttributeValue("class", null);
                    if (className == "toclevel2")
                    {
                        string href = item.FirstChild.NextSibling.GetAttributeValue("href", null);
                        string name = item.FirstChild.NextSibling.GetAttributeValue("title", null);
                        if (null != href && null != name)
                        {
                            name = name.ToLower().Trim();
                            switch (name)
                            {
                                case "properties":
                                    propsNode.Add(new XAttribute("Link", XmlConvert.EncodeName(_rootAdress + href)));
                                    ParsePowerPointTypeProperties(propsNode, func);
                                    break;
                                case "methods":
                                    methodsNode.Add(new XAttribute("Link", XmlConvert.EncodeName(_rootAdress + href)));
                                    ParsePowerPointTypeMethods(methodsNode, func);
                                    break;
                                case "events":
                                    eventsNode.Add(new XAttribute("Link", XmlConvert.EncodeName(_rootAdress + href)));
                                    ParsePowerPointTypeEvents(eventsNode, func);
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                }
            }
        }
开发者ID:netintellect,项目名称:NetOffice,代码行数:50,代码来源:Parser.cs


示例12: ParsePowerPointTypesMembers

 private static void ParsePowerPointTypesMembers(XElement typeNode, LogAction func)
 {
     func("Parse PowerPoint Type Members");
     foreach (XElement item in typeNode.Element("Types").Elements("Type"))
     {
         ParseOfficeTypeMembers(item, func);
     }
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:8,代码来源:Parser.cs


示例13: updateDatabase

 /// <summary>
 /// Update database
 /// </summary>
 /// <param name="device"></param>
 /// <param name="logAction"></param>
 /// <param name="logDetails"></param>
 private static void updateDatabase(DeviceView device, Power power, LogAction logAction, string logDetails)
 {
     device.Power = power;
       device.Save();
       new Log(LogType.Information, logAction, device.ToString() + " " + logDetails);
 }
开发者ID:calimeradriver,项目名称:Domotica,代码行数:12,代码来源:DeviceHelper.cs


示例14: Log

 public void Log(Type classname, LoggingLevel level, LogAction action, string message)
 {
     _worker(classname, level, action, message);
 }
开发者ID:Xamtastic,项目名称:TextFileRamDisk,代码行数:4,代码来源:Logger.cs


示例15: Log

		public static bool Log(string message, LogAction action, string destination)
		{
			return Log(message, action, destination, null);
		}
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:4,代码来源:Errors.cs


示例16: ParseVisio

 internal static void ParseVisio(XDocument document, LogAction func)
 {
     XElement VisioNode = new XElement("Visio");
     (document.FirstNode as XElement).Add(VisioNode);
     ParseVisioTypes(VisioNode, func);
     ParseVisioEnums(VisioNode, func);
     ParseVisioTypesMembers(VisioNode, func);
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:8,代码来源:Parser.cs


示例17: AnnounceThread

    /**
     * There can only safely be one of these threads running
     */
    protected void AnnounceThread() {
      Brunet.Util.FuzzyEvent fe = null;
      try {
        int millisec_timeout = 5000; //log every 5 seconds.
        IAction queue_item = null;
        bool timedout = false;
        if( ProtocolLog.Monitor.Enabled ) {
          IAction log_act = new LogAction(_packet_queue);
          Action<DateTime> log_todo = delegate(DateTime dt) {
            EnqueueAction(log_act);
          };
          fe = Brunet.Util.FuzzyTimer.Instance.DoEvery(log_todo, millisec_timeout, millisec_timeout/2);
        }
        while( 1 == _running ) {
          queue_item = _packet_queue.Dequeue(millisec_timeout, out timedout);
          if (!timedout) {
            _current_action = queue_item;
            queue_item.Start();
          }
        }
      }
      catch(System.InvalidOperationException x) {
        //This is thrown when Dequeue is called on an empty queue
        //which happens when the BlockingQueue is closed, which
        //happens on Disconnect
        if(1 == _running) {
          ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
            "Running in AnnounceThread got Exception: {0}", x));
        }
      }
      catch(Exception x) {
        ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
        "ERROR: Exception in AnnounceThread: {0}", x));
      }
      finally {
        //Make sure we stop logging:
        if( fe != null ) { fe.TryCancel(); }
      }
      ProtocolLog.Write(ProtocolLog.Monitor,
                        String.Format("Node: {0} leaving AnnounceThread",
                                      this.Address));

    }
开发者ID:hseom,项目名称:brunet,代码行数:46,代码来源:Node.cs


示例18: ParseAccessConstants

 private static void ParseAccessConstants(XElement excelNode, LogAction func)
 {
     func("Parse Access Constants");
     XElement constantNode = new XElement("OldConstants", _rootAdress + _accessConstantsRelative);
     excelNode.Add(constantNode);
     func(String.Format("{0} Access Contants recieved", 1));
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:7,代码来源:Parser.cs


示例19: ParseAccess

 internal static void ParseAccess(XDocument document, LogAction func)
 {
     XElement accessNode = new XElement("Access");
     (document.FirstNode as XElement).Add(accessNode);
     ParseAccessTypes(accessNode, func);
     ParseAccessEnums(accessNode, func);
     ParseAccessConstants(accessNode, func);
     ParseAccessTypesMembers(accessNode, func);
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:9,代码来源:Parser.cs


示例20: ParseExcel

 internal static void ParseExcel(XDocument document, LogAction func)
 {
     XElement excelNode = new XElement("Excel");
     (document.FirstNode as XElement).Add(excelNode);
     ParseExcelTypes(excelNode, func);
     ParseExcelEnums(excelNode, func);
     ParseExcelTypesMembers(excelNode, func);
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:8,代码来源:Parser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LogAggregator类代码示例发布时间:2022-05-24
下一篇:
C# Log4NetCustom.LogMessage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap