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


C# CLogger类代码示例

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


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

示例1: InitializeLogger

 public InitializeLogger(int trc_Level)
 {
     logging_interval = 60000;
        log_size = 1000000;
        l = new CLogger();
        trc_level = trc_Level;
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:7,代码来源:InitializeLogger.cs

示例2: Log

 public static void Log(CLogger logger, LogType logType, LogLevel logLevel, string header, string message, LogType defaultLogType)
 {
     try {
         if (logger != null) {
             logger.Log(logType, logLevel, header + " : " + message);
             return;
         }
     } catch {
     }
     Log(logger, logType, logLevel, header, message);
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:11,代码来源:LogHelper.cs

示例3: InitializeLogger

 public static bool InitializeLogger()
 {
     try
     {
         L = new CLogger();
         L.SetLogLevel((LogLevel)((TraceLevel < 0 || TraceLevel > 4) ? 3 : TraceLevel));
         L.SetLogFile(@"C:\tmp\IISRecorderLog.log");
         L.SetTimerInterval(LogType.FILE, 0);
         L.SetLogFileSize(10000000);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("RemoteRecorderBase->InitializeLogger() ", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:17,代码来源:Program.cs

示例4: InitializeLogger

 public bool InitializeLogger()
 {
     try
     {
         L = new CLogger();
         L.SetLogLevel((LogLevel)((trcLevel < 0 || trcLevel > 4) ? 3 : trcLevel));
         L.SetLogFile(errLog);
         L.SetTimerInterval(LogType.FILE, loggingInterval);
         L.SetLogFileSize(logSize);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("RemoteRecorderBase->InitializeLogger() ", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:17,代码来源:Class1.cs

示例5: Test1

        public void Test1(string dllPath, CLogger logger)
        {
            Assembly testAssembly = Assembly.LoadFile(dllPath);
            Type type = testAssembly.GetType("Parser.IISV_7_1_0Recorder");
            var instance = (CustomBase)Activator.CreateInstance(type);

            TestRecorder testRecorder = new TestRecorder();

            //instance.GetInstanceListService()["Security Manager Remote Recorder"] = new CustomServiceBase();
            //CustomServiceBase s = base.GetInstanceService("Security Manager Remote Recorder");

            string iisLogFileLocation = @"C:\tmp\iisLogs\";

            //Assembly içindeki erişilen tüm varieble'ların değerlerini gösterir.
            /*
            FieldInfo[] myFields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
            Console.WriteLine(type);

            for (int i = 0; i < myFields.Length; i++)
            {
                Console.WriteLine("The value of {0} is: {1}",
                    myFields[i].Name, myFields[i].GetValue(instance));
            }
             * */

            /*FieldInfo fieldInfoDir = type.GetField("Dir", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoDir.SetValue(instance, iisLogFileLocation);
            Console.WriteLine("Dir. {0}", fieldInfoDir.GetValue(instance));*/

            /* FieldInfo fieldInfoUsingRegistry = type.GetField("usingRegistry", BindingFlags.NonPublic | BindingFlags.Instance);
             fieldInfoUsingRegistry.SetValue(instance, false);
             Console.WriteLine("usingRegistry.{0}", fieldInfoUsingRegistry.GetValue(instance));*/

            /*FieldInfo fieldInfoLogFileLocation = type.GetField("logFileLocation", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLogFileLocation.SetValue(instance, @"C:\tmp\iis.log");
            Console.WriteLine("fieldInfoLogFileLocation.{0}", fieldInfoLogFileLocation.GetValue(instance));*/

            /*FieldInfo fieldInfoLogFileLocation = type.GetField("Log", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLogFileLocation.SetValue(instance, logger);
            Console.WriteLine("fieldInfoLogFileLocation.{0}", fieldInfoLogFileLocation.GetValue(instance));*/

            //readMethod
            //threadSleepTime
            //dontSend
            /*
            FieldInfo fieldInfodontSend = type.GetField("dontSend", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfodontSend.SetValue(instance, true);
            Console.WriteLine("threadSleepTime:'{0}'", fieldInfodontSend.GetValue(instance));
            */

            //FieldInfo fieldInfoTEST_ACTIVE = type.GetField("TEST_ACTIVE", BindingFlags.NonPublic | BindingFlags.Instance);
            //fieldInfoTEST_ACTIVE.SetValue(instance, testRecorder.GetInstanceService("Security Manager Remote Recorder"));

            FieldInfo fieldInfologFileSize = type.GetField("logFileSize", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfologFileSize.SetValue(instance, (uint)10000000);
            Console.WriteLine("LastKeywords:'{0}'", fieldInfologFileSize.GetValue(instance));

            FieldInfo fieldInfoLastKeywords = type.GetField("lastKeywords", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLastKeywords.SetValue(instance, "");
            Console.WriteLine("LastKeywords:'{0}'", fieldInfoLastKeywords.GetValue(instance));

            DateTime dt = DateTime.Now;
            string dateTime = dt.ToString(dateFormat);
            FieldInfo fieldInfoLastRecDate = type.GetField("LastRecDate", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoLastRecDate.SetValue(instance, dateTime);
            Console.WriteLine("LastRecDate:'{0}'", fieldInfoLastRecDate.GetValue(instance));

            FieldInfo fieldInfothreadSleepTime = type.GetField("threadSleepTime", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfothreadSleepTime.SetValue(instance, 10);
            Console.WriteLine("threadSleepTime:'{0}'", fieldInfothreadSleepTime.GetValue(instance));

            FieldInfo fieldInfoRemoteHost = type.GetField("remoteHost", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoRemoteHost.SetValue(instance, "");
            Console.WriteLine("RemoteHost:'{0}'", fieldInfoRemoteHost.GetValue(instance));

            FieldInfo fieldInfoPosition = type.GetField("Position", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoPosition.SetValue(instance, 0);
            Console.WriteLine("Position:'{0}'", fieldInfoPosition.GetValue(instance));

            FieldInfo fieldInfoUser = type.GetField("user", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoUser.SetValue(instance, "Administrator");
            Console.WriteLine("User:'{0}'", fieldInfoUser.GetValue(instance));

            FieldInfo fieldInfoSleepTime = type.GetField("_SleepTime", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoSleepTime.SetValue(instance, 10);
            Console.WriteLine("_SleepTime:'{0}'", fieldInfoSleepTime.GetValue(instance));

            FieldInfo fieldInfoPassword = type.GetField("password", BindingFlags.NonPublic | BindingFlags.Instance);
            fieldInfoPassword.SetValue(instance, "");
            Console.WriteLine("Password:'{0}'", fieldInfoPassword.GetValue(instance));

            Console.WriteLine("Dir. '{0}'", FieldSetNewValue("Dir", type, instance, iisLogFileLocation));
            Console.WriteLine("UsingRegistry.'{0}'", FieldSetNewValue("usingRegistry", type, instance, false));

            RegistryKey regIn = Registry.LocalMachine.OpenSubKey("Software\\NATEK\\Security Manager\\Remote Recorder");
            string home = (String)regIn.GetValue("Home Directory");

            Console.WriteLine("home: {0}", home);
            Console.ReadLine();

//.........这里部分代码省略.........
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:101,代码来源:CustomBaseExtended.cs

示例6: Initialize_Logger

 public bool Initialize_Logger()
 {
     try
     {
         L = new CLogger();
         switch (trc_level)
         {
             case 0:
                 {
                     L.SetLogLevel(LogLevel.NONE);
                 } break;
             case 1:
                 {
                     L.SetLogLevel(LogLevel.INFORM);
                 } break;
             case 2:
                 {
                     L.SetLogLevel(LogLevel.WARN);
                 } break;
             case 3:
                 {
                     L.SetLogLevel(LogLevel.ERROR);
                 } break;
             case 4:
                 {
                     L.SetLogLevel(LogLevel.DEBUG);
                 } break;
         }
         if (!string.IsNullOrEmpty(LogLocation))
             err_log = Path.Combine(LogLocation, @"EventLogFileAuditRecorder" + Id + ".log");
         L.SetLogFile(err_log);
         L.SetTimerInterval(LogType.FILE, logging_interval);
         L.SetLogFileSize(log_size);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("Security Manager RedHatSecure Recorder", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:41,代码来源:EventLogFileAuditRecorder.cs

示例7: virusFound

        static void virusFound(ref CustomBase.Rec r, String line)
        {
            int file = 0;
            String[] arr = new String[100];
            arr = line.Split(',');
            for (int i = 1; i < arr.Length; i++)
            {
                //
                string[] temp = new String[100];
                string[] temp2 = new String[100];
                Boolean b;
                b = arr[i].Contains("Event time");
                if (b == false)
                {
                    //tüm par için
                    temp = arr[i].Split(':');
                    // temp kontrolü : olmayan satýrlar için
                    if (temp.Length > 1)
                    {
                        Allocate2(ref r, temp[0], temp[1].TrimEnd());
                        if (temp[0] == "Occurrences")
                        {
                            file = i;
                        }
                    }
                }
                else if (b == true)
                {
                    //dateandtime için sadece
                    //2009-03-09 09:00:00
                    temp2 = SpaceSplit(arr[i], false);

                    String date = temp2[2].Trim().Replace('-', '/') + " " + temp2[3].Trim();
                    DateTime dt = Convert.ToDateTime(date);
                    r.Datetime = dt.AddMinutes(zone).ToString("yyyy/MM/dd HH:mm:ss");

                    CLogger L2 = new CLogger();
                    L2.Log(LogType.FILE, LogLevel.DEBUG, "date" + date);
                }
            }
            //virus file
            r.CustomStr10 = arr[file + 1];
        }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:43,代码来源:SymantecSepSyslogRecorder.cs

示例8: dateandtime

        static String dateandtime(String w3, String w4, String w5)
        {
            //String dType = arr[3] + " " + arr[4] + " " + arr[5];
            String mounth, day, year, time;
            day = w4;
            time = w5;
            year = DateTime.Now.Year.ToString();
            switch (w3)
            {
                case "Jan":
                    mounth = "01";
                    break;
                case "Feb":
                    mounth = "02";
                    break;
                case "Mar":
                    mounth = "03";
                    break;
                case "Apr":
                    mounth = "04";
                    break;
                case "May":
                    mounth = "05";
                    break;
                case "Jun":
                    mounth = "06";
                    break;
                case "Jul":
                    mounth = "07";
                    break;
                case "Aug":
                    mounth = "08";
                    break;
                case "Sep":
                    mounth = "09";
                    break;
                case "Oct":
                    mounth = "10";
                    break;
                case "Nov":
                    mounth = "11";
                    break;
                case "Dec":
                    mounth = "12";
                    break;
                default:
                    mounth = DateTime.Now.Month.ToString();
                    break;

            }
            String dType = mounth + "/" + day + "/" + year + " " + time;
            Boolean dtError = false;
            DateTime dt = DateTime.MinValue;
            try
            {
                dt = Convert.ToDateTime(dType);
            }
            catch
            {
                dtError = true;
            }
            if (dtError)
            {
                try
                {
                    dType = day + "/" + mounth + "/" + year + " " + time;
                    dt = Convert.ToDateTime(dType);
                }
                catch
                {
                    return "";
                }
            }
            dType = dt.AddMinutes(zone).ToString("yyyy/MM/dd HH:mm:ss");

            CLogger L2 = new CLogger();
            L2.Log(LogType.FILE, LogLevel.DEBUG, "date" + dType);

            return dType;
        }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:80,代码来源:SymantecSepSyslogRecorder.cs

示例9: ParserStub

        public ParserStub()
        {
            started = true;
              usingRegistry = true;
              usingKeywords = true;
              keywordsFound = false;
              startFromEndOnLoss = false;
              checkLineMismatch = true;
              lineLimit = 100;
              startLineCheckCount = 10;
              parsing = false;
              parseLock = new Mutex();
              disposeCheck = false;
              loadWatcher = false;
              readMethod = "sed";
              enc = Encoding.Default;

            #if STAYCONNECTED
            stayConnected = false;
            #endif

              Id = 0;

              /*checkTimer = new System.Timers.Timer(60000);
              checkTimer.Enabled = false;
              checkTimer.Elapsed += new System.Timers.ElapsedEventHandler(checkTimer_Elapsed);
              usingCheckTimer = false;*/

              checkTimerSSH = new System.Timers.Timer(10);
              checkTimerSSH.Enabled = false;
              checkTimerSSH.Elapsed += new System.Timers.ElapsedEventHandler(checkTimerSSH_Elapsed);

              Log = new CLogger();
              Log.SetLogLevel(LogLevel.ERROR);
        }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:35,代码来源:ParserStub.cs

示例10: EventLogWinApi

 public EventLogWinApi()
 {
     Log = new CLogger();
     checkTimer = new Timer(2000);
     checkTimer.Elapsed += new ElapsedEventHandler(checkTimer_Elapsed);
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:6,代码来源:EventLogWinApi.cs

示例11: GetName

 /// <summary>
 /// The method converts SID string (user, group) into object name.
 /// Bu fonksiyon 06.08.2012 tarihinde Hazine Müsteþarlýðýnda bulunan sistemdeki 
 /// SID(Security Id)'leri anlamlý olan name'e translate etmek amacý ile Onur Sarýkaya tarafýndan eklenmiþtir. 
 /// </summary>
 /// <param name="name">SID string.</param>
 /// <returns>Object name in form domain\object_name.</returns>
 public static String GetName(CLogger L, string sid)
 {
     try
     {
         return new System.Security.Principal.SecurityIdentifier(sid).Translate(
                 typeof(System.Security.Principal.NTAccount)).ToString();
     }
     catch (Exception exception)
     {
         if (L != null)
             L.Log(LogType.FILE, LogLevel.ERROR, "Error on GetName: " + exception.Message);
         //WriteMessage("GetName Error: " + exception.Message);
         return sid;
     }
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:22,代码来源:Class1.cs

示例12: Parser

        public Parser(String file)
        {
            FileName = file;

            LoadWatcher();

            started = true;

            Log = new CLogger();

            Log.SetLogLevel(LogLevel.ERROR);
        }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:12,代码来源:Parser.cs

示例13: Initialize_Logger

        public bool Initialize_Logger()
        {
            try
            {
                _l = new CLogger();
                switch (_trcLevel)
                {
                    case 0:
                        {
                            _l.SetLogLevel(LogLevel.NONE);
                        } break;
                    case 1:
                        {
                            _l.SetLogLevel(LogLevel.INFORM);
                        } break;
                    case 2:
                        {
                            _l.SetLogLevel(LogLevel.WARN);
                        } break;
                    case 3:
                        {
                            _l.SetLogLevel(LogLevel.ERROR);
                        } break;
                    case 4:
                        {
                            _l.SetLogLevel(LogLevel.DEBUG);
                        } break;
                }

                _l.SetLogFile(_errLog);
                _l.SetTimerInterval(LogType.FILE, LoggingInterval);
                _l.SetLogFileSize(LogSize);

                return true;
            }
            catch (Exception er)
            {
                EventLog.WriteEntry("Security Manager CryptTechHotspotV_1_0_1Recorder", er.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:41,代码来源:Class1.cs

示例14: InitializeLogger

 protected bool InitializeLogger()
 {
     try
     {
         L = new CLogger();
         switch (TrcLevel)
         {
             case 0:
                 {
                     L.SetLogLevel(LogLevel.NONE);
                 }
                 break;
             case 1:
                 {
                     L.SetLogLevel(LogLevel.INFORM);
                 }
                 break;
             case 2:
                 {
                     L.SetLogLevel(LogLevel.WARN);
                 }
                 break;
             case 3:
                 {
                     L.SetLogLevel(LogLevel.ERROR);
                 }
                 break;
             case 4:
                 {
                     L.SetLogLevel(LogLevel.DEBUG);
                 }
                 break;
         }
         L.SetLogFile(ErrLog);
         L.SetTimerInterval(LogType.FILE, LoggingInterval);
         L.SetLogFileSize(LogSize);
         return true;
     }
     catch (Exception er)
     {
         EventLog.WriteEntry("Security Manager IISUnified Recorder", er.ToString(), EventLogEntryType.Error);
         return false;
     }
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:44,代码来源:IISUnifiedRecorder.cs

示例15: InitializeLogger

        public Boolean InitializeLogger()
        {
            try
            {
                _log = new CLogger();

                switch (_traceLevel)
                {
                    case 0:
                        _log.SetLogLevel(LogLevel.NONE);
                        break;
                    case 1:
                        _log.SetLogLevel(LogLevel.INFORM);
                        break;
                    case 2:
                        _log.SetLogLevel(LogLevel.WARN);
                        break;
                    case 3:
                        _log.SetLogLevel(LogLevel.ERROR);
                        break;
                    case 4:
                        _log.SetLogLevel(LogLevel.DEBUG);
                        break;
                }

                _log.SetLogFile(_errLog);
                _log.SetTimerInterval(LogType.FILE, _loggingInterval);
                _log.SetLogFileSize(_logSize);

                return true;
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("Security Manager SQLServer Recorder", ex.ToString(), EventLogEntryType.Error);
                return false;
            }
        }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:37,代码来源:Class1.cs


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