Tool-type log and trace

Source: Internet
Author: User

CodeAddress: https://github.com/hanxi/Log

 /*  ========================================================== =========================================== # Filename: log. h # Desc: log record, only support single thread, support webpage format # Author: hanxi # Email: hanxi.com@gmail.com # homepage:  Http://hanxi.cnblogs.com  # Version: 0.0.1 # lastchange: 2013-03-07 18:24:21 # History: ========================================================== ============================================  */  # Ifndef _ log_h _  # Define _ Log_h _ // STD # Include <iostream> # Include <Fstream> # Include < String > # Include <Ctime> # Include <Cstdlib> # Define Html_log 1 //  Output in HTML Format  # Define Txt_log 2 //  Output in TXT format  Class Log {  Private  :  Static STD: ofstream ms_file; //  Log File stream      Static   Const   Char * Ms_path; //  Log File Path      Static   Int Ms_loglevel; //  Logs smaller than loglevel will be printed     Static   Int Ms_logfiletype; //  Log File Type      Int  M_nowlevel; STD ::  String * M_thefunctionname; //  Enter the function name  Public  :  Static   Void S_init ( Const   Char * I _path, Int I _loglevel, Int  I _filetype );  Static   Void  S_stop ();  Static   Const   Char * Endl; log (  Const   Char * Funcname, Int  Loglevel ); ~ Log (); Template <Typename type> Void  Debug (type MSG); Template <Typename type> Log & Operator < (Type MSG );};  //  Initialize static member variables  STD: ofstream log: ms_file;  Const   Char * Log: ms_path = NULL; //  Log File Path  Int Log: ms_loglevel = 0 ; //  Logs smaller than loglevel will be printed  Int Log: ms_logfiletype = 0 ; //  Log File Type  Const   Char * Log: Endl = "  \ N  " ;
 /* ========================================================== =========================================== # Filename: trace. h # Desc: Debugging class # Author: hanxi # Email: hanxi.com@gmail.com # homepage:  Http://hanxi.cnblogs.com  # Version: 0.0.1 # lastchange: 2013-03-08 13:05:03 # History: ========================================================== ============================================  */  # Ifndef _ trace_h _  # Define _ Trace_h _ # Include <Iostream> Using   Namespace STD;  Class  Trace {  Public  : Trace (  Const   Char * Name ); ~ Trace ();  Void Debug ( Const   String & MSG );  Static   Bool Traceisactive;  Private  :  String * Thefunctionname ;};  Bool Trace: traceisactive = False ;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.