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


C# LogManager类代码示例

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


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

示例1: MemTcpClient

        /// <summary>
        /// Initialize and start new TcpClientHandler
        /// </summary>
        /// <param name="client">TcpClient to Handle</param>
        public MemTcpClient(TcpClient client, ProtocolType protocol)
        {
            _logManager = new LogManager(client.Client.RemoteEndPoint.ToString());
            _logManager.Info("MemTcpClient", "\tNew client connected on protocol :" + protocol.ToString());
            
            _client = client;
            _stream = _client.GetStream();

            _executionManager = new SequentialExecutionManager(_logManager);

            _inputBuffer = new byte[MAX_BUFFER_SIZE];
            _inputDataStream = new DataStream();

            _protocol = protocol;
            if (protocol == ProtocolType.Text)
            {
                _parser = new TextProtocolParser(_inputDataStream, this, _logManager);
                _responseManager = new TextResponseManager(_stream, _logManager);
            }
            else
            {
                _parser = new BinaryProtocolParser(_inputDataStream, this, _logManager);
                _responseManager = new BinaryResponseManager(_stream, _logManager);
            }
            _responseManager.MemTcpClient = this;

            _parser.CommandConsumer = _executionManager;
            _executionManager.CommandConsumer = _responseManager;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:33,代码来源:MemTcpClient.cs

示例2: frmGraph3D

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="log">ログ</param>
        /// <param name="index">3D表示インデックス</param>
        public frmGraph3D(LogManager log, int index)
        {
            InitializeComponent();

            this.log = log;
            this.index = index;
        }
开发者ID:kse-jp,项目名称:RM-3000,代码行数:12,代码来源:frmGraph3D.cs

示例3: Main

        static void Main(string[] args)
        {
            LogManager lm = new LogManager("TestSearch", @"C:\Users\Thibault\Documents\Logs\", 3);

            //LogManager lm2 = new LogManager("log");
            // LogManager f = new LogManager("fu");
            lm.logEvent("Programme principal", "Erreur 7");
            lm.logEvent("Programme secondaire", "Erreur 0");
            /*lm.logEvent("Programme principal", "Nlkd,qds");
            lm.logEvent("Programme principal", "kdjzalmk");
            lm.logEvent("Programme principal", "Rhaaaa");*/

            //Test de la recherche

            DateTime now = new DateTime(2011,11,27,16,36,45);
            DateTime end = now.AddDays(3);
            lm.getLogs(now, end);

            //lm.getLogs(now, end, "Programme secondaire");

            // lm.logEvent("Programme secondaire", "Erreur 7", "Test2");
              //ThreadTest tt = new ThreadTest(lm);

              /*  try
            {
                StreamReader sr = System.IO.File.OpenText("test");
            }
            catch (Exception err)
            {
                lm.logException("Programme principal", err);
            }*/
        }
开发者ID:T-Dnzt,项目名称:sharpLog,代码行数:32,代码来源:Program.cs

示例4: ZLogViewer

        public ZLogViewer()
        {
            InitializeComponent();

            this.mLogManager = LogManager.GetInstance();
            this.openFileDialog.Multiselect = true;
            this.ListViewLog.Dock = DockStyle.Fill;
            this.textBoxLog.Dock = DockStyle.Fill;
            this.fileToolStripMenuItem.Click += this.GetAllLogPaths;
            this.mergeToolStripMenuItem.Click += this.GetAllLogPathsMerge;
            this.btnFilter.Click += this.Filter;
            this.btnNext.Click += this.SearchNext;
            this.btnPrevious.Click += this.SearchPrev;
            this.ListViewLog.ColumnClick += this.ColumnFilter;
            this.ListViewLog.MultiSelect = false;
            this.ListViewLog.SelectedIndexChanged += this.ShowLog;
            this.ListViewLog.ItemSelectionChanged += this.listview_itemselectionchanged;
            this.ListViewLog.Validated += this.listview_validated;
            this.DragDrop += DragAndDropFile;
            this.ListViewLog.DragDrop += DragAndDropFile;
            this.ListViewLog.DragEnter += listViewFolder_DragEnter;
            this.textBoxLog.MouseClick += this.aa;
            this.toolStripProgressBar.Dock = DockStyle.Bottom;
            this.HelpRequested += this.HelpPopup;
            this.checkBoxAutoReresh.CheckedChanged += AutoRefresh;
            this.decryptToolStripMenuItem.Click += DecryptText;
            LogManager.readCompleteCallBack += Refresh;
            LogManager.SetFormControl(this);
            this.ListViewLog.HideSelection = true;
            //ZLog.AddLogEventHander(this.SetTextAsLog);
        }
开发者ID:ZeroneBit,项目名称:ZLogView,代码行数:31,代码来源:ZLogViewer.cs

示例5: Log

 internal Log(LogManager manager, string name)
 {
     this._manager = new WeakReference(manager);
     this._name = name;
     this._level = LogLevel.None;
     manager.Add(new Log.Shadow(this));
 }
开发者ID:pkgs-at,项目名称:com.unitystack,代码行数:7,代码来源:Log.cs

示例6: frmMain

        /// <summary>
        /// Constructor
        /// </summary>
        public frmMain()
        {
            InitializeComponent();

            //ボード情報取得イベント
            CommunicationMonitor.GetInstance().GotBoardInfoEvent += new EventHandler(CommunicationMonitor_GotBoardInfoEvent);

            //メッセージ要求
            CommunicationMonitor.GetInstance().ShowMessageRequestEvent += new CommunicationMonitor.ShowMessageRequestHandler(CommunicationMonitor_ShowMessageRequestEvent);

            //監視モニタコメント表示要求
            CommunicationMonitor.GetInstance().ShowCommunicationCommentEvent += new CommunicationMonitor.ShowCommunicationCommentHandler(CommunicationMonitor_ShowCommunicationCommentEvent);

            // ログ設定
            var logConfigPath = ConfigurationManager.AppSettings["LogConfigPathUi"];
            if (string.IsNullOrEmpty(System.IO.Path.GetDirectoryName(logConfigPath)))
            {
                // ファイル名だけの場合はRM-3000.exeと同じパスとしてフルパス化する
                var assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
                var localPath = (new System.Uri(assemblyPath)).LocalPath;
                logConfigPath = System.IO.Path.GetDirectoryName(localPath) + @"\" + logConfigPath;
            }
            this.log = LogManager.Instance;
            this.log.SetupLog(logConfigPath);

            AppResource.SetControlsText(this);

            ContentsLoad();
        }
开发者ID:kse-jp,项目名称:RM-3000,代码行数:32,代码来源:frmMain.cs

示例7: LogManager

 public LogManager()
 {
     instance = this;
     logPath = GetLogPath();
     logStream = new FileStream(logPath, FileMode.Create, FileAccess.Write, FileShare.Read);
     writer = new StreamWriter(logStream);
 }
开发者ID:huntintiger1004,项目名称:nucleuscoop,代码行数:7,代码来源:LogManager.cs

示例8: TestGetLoggerByType

        public void TestGetLoggerByType()
        {
            var manager = new LogManager(new LoggingConfiguration());

            var logger = manager.GetLogger<LogManagerBaseTests>();
            Assert.NotNull(logger);
        }
开发者ID:onovotny,项目名称:MetroLog,代码行数:7,代码来源:LogManagerTests.cs

示例9: TestGetLogger

        public void TestGetLogger()
        {
            var manager = new LogManager(new LoggingConfiguration());

            var logger = manager.GetLogger("Foobar");
            Assert.NotNull(logger);
        }
开发者ID:onovotny,项目名称:MetroLog,代码行数:7,代码来源:LogManagerTests.cs

示例10: InterfaceManager

 public InterfaceManager(TextBox tBox)
 {
     PANGU_Manager.killPANGU();
     navigationMapManager = new NavigationMapManager();
     logManager = new LogManager(tBox);
     logManager.clearSimulationLog();
 }
开发者ID:Stewart-Taylor,项目名称:DynamicPathPlanner,代码行数:7,代码来源:InterfaceManager.cs

示例11: Main

        public static void Main(string[] args)
        {
            LogManager customLogManager = new LogManager(LogManager.ErrorType.OFF, LogManager.ErrorType.FATAL, "customlogfile.log", true);
            // all delegate where execute in thread
            LogManager.defaultInstance.objectExceptCatched += objLog;
            LogManager.defaultInstance.writeToConsole = LogManager.ErrorType.TRACE;

            DemoClass demoClass = new DemoClass(){ jobs = "Demo for PonyLogManager" };
            demoClass.sw.Start();

            LogManager.defaultInstance.trace("Start demo");
            try{
                int a = 0, b = 0;
                a /= b;
            } catch (Exception e) {
                e.ERROR();
                // you can also
                LogManager.defaultInstance.debug(e);
                // or
                e.DEBUG(customLogManager);
                customLogManager.debug(e);
            }
            demoClass.sw.Stop();
            LogManager.defaultInstance.debug(demoClass);
            LogManager.defaultInstance.trace("End demo");
            Console.Read();
        }
开发者ID:bawaaaaah,项目名称:PonyLogManager,代码行数:27,代码来源:Program.cs

示例12: Write

        public void Write(string category, string source, LogType logType, string logMsg, string detail)
        {
            Guid id = Guid.NewGuid();

            LogEntity log = new LogEntity();
            log.Id = id;
            log.Category = category;
            log.Source = source;
            log.Type = (short)logType;
            log.Message = logMsg;

            LogDetailEntity logDetail = new LogDetailEntity();
            logDetail.Id = id;
            logDetail.LogDetail = detail;

            try
            {
                using (ILHDBTran tran = BeginTran())
                {
                    LogManager manager = new LogManager(tran);
                    manager.AddLog(log);
                    manager.AddLogDetail(logDetail);
                    tran.Commit();
                }
            }
            catch (Exception ex)
            {
                FileLogWriter writer = new FileLogWriter();
                writer.Write(LogCategory.LogWrite, "Write log to database", ex);
                writer.Write(category, source, logType, logMsg, detail);
            }
        }
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:32,代码来源:LogFacade.cs

示例13: log

        public static void log(string information, LogManager.Level level)
        {
            /// Without this line under, if using Debug.WriteLine in multiple classes the settings will be unable to be read. They will be returned as null and the application will fall to its knees.
            /// Looking at AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, it seems that the config path isn't set, trying to set it here too solves the issue. For now...
            AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", MainConsole.fullConfig);

            string logMessage = null;
            switch (level) {

                // INFO
                case Level.INFO:
                    logMessage = "[INFO] " + information;
                    break;

                // ERROR
                case Level.ERROR:
                    logMessage = "[ERROR] " + information;
                    break;

                // SETTING
                case Level.SETTING:
                    logMessage = "[SETTING] " + information;
                    break;

                default:
                    break;
            }
            Debug.WriteLine(logMessage);
        }
开发者ID:ElPumpo,项目名称:TinyNvidiaUpdateChecker,代码行数:29,代码来源:LogManager.cs

示例14: Initialize

 /// <summary>
 /// Initialize log
 /// </summary>
 /// <param name="_logPath"></param>
 public static void Initialize(string _logPath, LogLevel logLevel = LogLevel.Information)
 {
     singleton = new LogManager();
     singleton.LogPath = _logPath;
     singleton.currentLogLevel = logLevel;
     singleton.Start();
 }
开发者ID:Gartley,项目名称:ss13remake,代码行数:11,代码来源:LogManager.cs

示例15: OverrideDefaultLevelIfSwitchConfigured

            public void OverrideDefaultLevelIfSwitchConfigured()
            {
                var logManager = new LogManager();
                var logger = logManager.CreateLogger("LogManager.Test");

                Assert.True(logger.IsDebugEnabled);
            }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:7,代码来源:LogManagerTests.cs


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