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


C# LogAction类代码示例

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


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


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