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

C# LogManager类代码示例

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

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



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


示例16: UserSpaceService

        /// <summary>
        /// Initialize a new OpenVPN service.
        /// </summary>
        /// <param name="binfile">path to openvpn</param>
        /// <param name="configfile">path to openvpn config</param>
        /// <param name="dir">directory where config lies</param>
        /// <param name="logs">provider to write logs to</param>
        /// <param name="host">The host to connect to (e.g. 127.0.0.1)</param>
        /// <param name="port">The port to connect to</param>
        /// <param name="logfile">file to write OpenVPN log to</param>
        /// <param name="smartCardSupport">enable SmartCard support</param>
        public UserSpaceService(string binfile, string configfile, 
            string dir, LogManager logs, string host, int port,
            string logfile, bool smartCardSupport)
        {
            m_logs = logs;

            m_psi.FileName = binfile;
            m_psi.WorkingDirectory = dir;
            m_psi.WindowStyle = ProcessWindowStyle.Hidden;
            m_psi.UseShellExecute = true;

            /*WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            principal.IsInRole(WindowsBuiltInRole.Administrator)*/
            if (Environment.OSVersion.Version.Major >= 6)
                m_psi.Verb = "runas";

            m_psi.CreateNoWindow = true;
            m_psi.Arguments =
                (logfile != null ? "--log \"" + logfile + "\"" : "") +
                " --config \"" + configfile + "\"" +
                " --management " + host + " " + port.ToString(CultureInfo.InvariantCulture) +
                " --management-query-passwords" +
                " --management-hold" +
                " --management-signal" +
                " --management-forget-disconnect" +
                " --auth-retry interact";

            if (smartCardSupport)
                m_psi.Arguments += " --pkcs11-id-management";
        }
开发者ID:fikalefaza,项目名称:openvpn-manager,代码行数:41,代码来源:UserSpaceService.cs


示例17: OverrideListenersIfSourceConfigured

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

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


示例18: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            string UserName =Request["UserName"] ?? string.Empty;
            string UserPwd = Request["UserPwd"] ?? string.Empty;
            string LogData =Request["LogData"] ?? string.Empty;

            try
            {
                UserManager um = new UserManager();
                if (um.CheckUser(UserName, UserPwd))
                {
                    if (!string.IsNullOrEmpty(LogData))
                    {
                        List<LogEvent> logList = JsonConvert.DeserializeObject<List<LogEvent>>(LogData);

                        if (logList != null)
                        {
                            LogManager lm = new LogManager();
                            bool result = lm.AddLog(logList);
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                LogExt.SetError(ex, "");
            }
        }
开发者ID:priceLiu,项目名称:logMGT,代码行数:29,代码来源:HttpLogReceive.aspx.cs


示例19: DefaultToStandardListenersIfSwitchNameUnknown

            public void DefaultToStandardListenersIfSwitchNameUnknown()
            {
                var logManager = new LogManager();
                var logger = (Logger)logManager.CreateLogger("LogManager.UnknownSource");

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


示例20: LogManager

 /// <summary>
 ///     Internal constructor.  This class cannot be instantiated externally.
 /// </summary>
 public LogManager()
 {
     if ( instance == null )
     {
         instance = this;
     }
 }
开发者ID:BitAlchemists,项目名称:DeepSpace,代码行数:10,代码来源:LogManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# LogMessage类代码示例发布时间:2022-05-24
下一篇:
C# LogLevels类代码示例发布时间: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