Changeset 7f596ce in nscp


Ignore:
Timestamp:
03/08/08 09:31:19 (5 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
febff5f
Parents:
a88c550
Message:
  • Changed so log is now in unicode format

Hopefully this will make it simpler to diagnose PDH issues in "strange locales".
If anyone hates this let me know and I will add an option to use "old ansi log".

  • Fixed so the console is logged as ANSI (properly) and all unicodes are discarded. This means "strangness" in unicode and non-us-ascii chars on the console,

so for details refer to the log-file which is proper unicode.

+ Since log module is loaded "after" the client has booted I added a "hello" message that prints the current version

(if you find this annoying let me know, I will make it optional :)

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • AutoBuild.h

    r6d3bbc1 r7f596ce  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,1,5 
    6 #define PRODUCTVER     0,3,1,5 
    7 #define STRFILEVER     _T("0.3.1.5") 
    8 #define STRPRODUCTVER  _T("0.3.1.5") 
    9 #define STRPRODUCTDATE  _T("2008-02-26") 
     5#define FILEVER        0,3,1,9 
     6#define PRODUCTVER     0,3,1,9 
     7#define STRFILEVER     _T("0.3.1.9") 
     8#define STRPRODUCTVER  _T("0.3.1.9") 
     9#define STRPRODUCTDATE  _T("2008-03-06") 
    1010#endif // AUTOBUILD_H 
  • NSClient++.cpp

    r2f01f93 r7f596ce  
    120120    } else if ( _wcsicmp( _T("test"), argv[1]+1 ) == 0 ) { 
    121121      std::wcout << "Launching test mode..." << std::endl; 
     122      LOG_MESSAGE_STD(_T("Booting: " SZSERVICEDISPLAYNAME )); 
    122123      try { 
    123124        if (serviceControll::isStarted(SZSERVICENAME)) { 
     
    135136      LOG_MESSAGE_STD(_T("Using settings from: ") + Settings::getInstance()->getActiveType()); 
    136137      LOG_MESSAGE(_T("Enter command to inject or exit to terminate...")); 
     138 
    137139      std::wstring s = _T(""); 
    138140      std::wstring buff = _T(""); 
     
    153155          std::wstring msg, perf; 
    154156          NSCAPI::nagiosReturn ret = mainClient.inject(t.first, t.second, ' ', true, msg, perf); 
    155           if (perf.empty()) 
    156             std::wcout << NSCHelper::translateReturn(ret) << _T(":") << msg << std::endl; 
    157           else 
    158             std::wcout << NSCHelper::translateReturn(ret) << _T(":") << msg << _T("|") << perf << std::endl; 
     157          std::wcout << NSCHelper::translateReturn(ret) << _T(":"); 
     158          std::cout << strEx::wstring_to_string(msg); 
     159          if (!perf.empty()) 
     160            std::cout << "|" << strEx::wstring_to_string(perf); 
     161          std::wcout << std::endl; 
    159162          buff = _T(""); 
    160163        } else { 
     
    593596    } 
    594597    if (g_bConsoleLog) { 
    595       std::wstring k = _T("?"); 
     598      std::string k = "?"; 
    596599      switch (msgType) { 
    597600      case NSCAPI::critical: 
    598         k =_T("c"); 
     601        k ="c"; 
    599602        break; 
    600603      case NSCAPI::warning: 
    601         k =_T("w"); 
     604        k ="w"; 
    602605        break; 
    603606      case NSCAPI::error: 
    604         k =_T("e"); 
     607        k ="e"; 
    605608        break; 
    606609      case NSCAPI::log: 
    607         k =_T("l"); 
     610        k ="l"; 
    608611        break; 
    609612      case NSCAPI::debug: 
    610         k =_T("d"); 
     613        k ="d"; 
    611614        break; 
    612       } 
    613       std::wcout << k << _T(" ") << file_stl << _T("(") << line << _T(") ") << message << std::endl; 
     615      }  
     616      std::cout << k << " " << strEx::wstring_to_string(file_stl) << "(" << line << ") " << strEx::wstring_to_string(message) << std::endl; 
    614617    } 
    615618    for (pluginList::size_type i = 0; i< messageHandlers_.size(); i++) { 
  • changelog

    ra88c550 r7f596ce  
    66 * Improved socket performance (would be nice if we could be used as a "hub") 
    77 * "The message is blocked by User Interface Privilege Isolation, Administrative applications that need to see it can allow it through by calling ChangeWindowMessageFilter after making sure the necessary security precautions are in place. " 
     8 
     92008-03-08 MickeM 
     10 * Changed so log is now in unicode format 
     11   Hopefully this will make it simpler to diagnose PDH issues in "strange locales". 
     12   If anyone hates this let me know and I will add an option to use "old ansi log". 
     13 * Fixed so the console is logged as ANSI (properly) and all unicodes are discarded. 
     14   This means "strangness" in unicode and non-us-ascii chars on the console, 
     15    so for details refer to the log-file which is proper unicode. 
     16 + Since log module is loaded "after" the client has booted I added a "hello" message that prints the current version 
     17    (if you find this annoying let me know, I will make it optional :) 
     18 
     192008-03-06 MickeM 
     20 * Fixed silly ordering bug with the <> syntax. 
    821 
    9222008-03-05 MickeM 
  • include/filter_framework.hpp

    rc3057cd r7f596ce  
    205205        hasFilter_ = true; 
    206206      } catch (handlers::handler_exception e) { 
    207         throw parse_exception(e.getMessage()); 
     207        throw parse_exception(e.getMessage() + _T(": ") + value); 
     208      } catch (...) { 
     209        throw parse_exception(_T("Unknown parse exception: ") + value); 
    208210      } 
    209211      return *this; 
     
    304306      if (value.substr(0,1) == _T(">")) { 
    305307        max = value.substr(1); 
     308      } else if (value.substr(0,2) == _T("<>")) { 
     309        neq = value.substr(2); 
    306310      } else if (value.substr(0,1) == _T("<")) { 
    307311        min = value.substr(1); 
     
    309313        eq = value.substr(1); 
    310314      } else if (value.substr(0,2) == _T("!=")) { 
    311         neq = value.substr(2); 
    312       } else if (value.substr(0,2) == _T("<>")) { 
    313315        neq = value.substr(2); 
    314316      } else if (value.substr(0,1) == _T("!")) { 
  • modules/CheckEventLog/CheckEventLog.cpp

    r8c7d67f r7f596ce  
    349349  std::wstring getValue() const { 
    350350    if (eventSource.hasFilter()) 
    351       return eventSource.getValue(); 
     351      return _T("event-source: ") + eventSource.getValue(); 
    352352    if (eventType.hasFilter()) 
    353       return eventType.getValue(); 
     353      return _T("event-type: ") + eventType.getValue(); 
    354354    if (eventSeverity.hasFilter()) 
    355       return eventSeverity.getValue(); 
     355      return _T("severity: ") + eventSeverity.getValue(); 
    356356    if (eventID.hasFilter()) 
    357       return eventID.getValue(); 
     357      return _T("event-id: ") + eventID.getValue(); 
    358358    if (message.hasFilter()) 
    359       return message.getValue(); 
     359      return _T("message: ") + message.getValue(); 
    360360    if (timeWritten.hasFilter()) 
    361       return timeWritten.getValue(); 
     361      return _T("time-written: ") + timeWritten.getValue(); 
    362362    if (timeGenerated.hasFilter()) 
    363       return timeGenerated.getValue(); 
     363      return _T("time-generated: ") + timeGenerated.getValue(); 
    364364    return _T("UNknown..."); 
    365365  } 
  • modules/SysTray/SysTray.cpp

    rc3057cd r7f596ce  
    106106      hWnd = hLogWnd; 
    107107    } else { 
    108       std::cout << "Fuck!!!" << std::endl; 
     108      std::cout << "Damnit!!!" << std::endl; 
    109109      NSC_LOG_ERROR_STD(_T("Failed to get mutex in logger, message discarded")); 
    110110    } 
Note: See TracChangeset for help on using the changeset viewer.