Changeset 986240


Ignore:
Timestamp:
12/28/11 15:35:18 (17 months ago)
Author:
Micke Prag <micke.prag@…>
Branches:
('master', 'a231b56d57a69513303d0061f5fa3e3cd51c85c1')('controller-upgrade', '72b31cc86eeeef18f1371a3067b6e8a5ca21abfc')('windows_service_fixes', 'df6bd2788365991d36d5af2a75833b8de2a5860f')
Children:
05c0ac7f0512c87789a6d17ef38fe63e800a2085
Parents:
50e69a476cde16d6a76f84133667182ecc4de8e3
git-author:
Micke Prag <micke.prag@telldus.se>2011-12-28 15:23:59+01:00
git-committer:
Micke Prag <micke.prag@telldus.se>2011-12-28 15:35:18+01:00
Message:

Add command line argument to debug output

Location:
telldus-core/service
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • telldus-core/service/Log.cpp

    r50e69a r986240  
    1212class Log::PrivateData { 
    1313public: 
    14         PrivateData() : logOutput(Log::System) {} 
     14        PrivateData() : logOutput(Log::System), debug(false) {} 
    1515 
    1616        Log::LogOutput logOutput; 
     17        bool debug; 
    1718 
    1819        static Log *instance; 
     
    105106} 
    106107 
     108void Log::setDebug() { 
     109        Log *log = Log::instance(); 
     110        log->d->debug = true; 
     111} 
     112 
    107113void Log::setLogOutput(LogOutput logOutput) { 
    108114        Log *log = Log::instance(); 
     
    111117 
    112118void Log::message(Log::LogLevel logLevel, const char *format, va_list ap) const { 
     119        if (logLevel == Debug && d->debug == false) { 
     120                return; 
     121        } 
    113122        if (d->logOutput == StdOut) { 
    114123                FILE *stream = stdout; 
  • telldus-core/service/Log.h

    r50e69a r986240  
    1717        static void error(const char *fmt, ...); 
    1818 
     19        static void setDebug(); 
    1920        static void setLogOutput(LogOutput logOutput); 
    2021 
  • telldus-core/service/TelldusWinService_win.cpp

    r50e69a r986240  
    113113        TelldusWinService instance; 
    114114 
     115        //Enable debug if we hade this supplied 
     116        for(unsigned int i = 1; i < argc; ++i) { 
     117                if (wcscmp(argv[i], L"--debug") == 0) { 
     118                        Log::setDebug(); 
     119                } 
     120        } 
     121 
    115122        // initialise service status 
    116123        instance.serviceStatus.dwServiceType = SERVICE_WIN32; 
Note: See TracChangeset for help on using the changeset viewer.