Changeset f898ded in nscp


Ignore:
Timestamp:
08/01/12 23:52:25 (10 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.1, 0.4.2
Children:
b611d99
Parents:
7263789
Message:
  • Added so running "nscp settings" will list all loaded settins context (as a tree). Quick way to see where your settings are stored.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • changelog

    r3af7590 rf898ded  
    772012-08-01 MickeM 
    88 * Resolved issue with crypto++ on linux (introduced by buildspeedups) 
     9 * Added so running "nscp settings" will list all loaded settins context (as a tree). 
     10   Quick way to see where your settings are stored. 
    911 
    10122012-07-31 MickeM 
  • include/settings/impl/settings_http.hpp

    rf14ab71 rf898ded  
    4242      if (!http::client::download(url.protocol, url.host, url.path, os, error)) { 
    4343        os.close(); 
    44         get_logger()->error(__FILE__, __LINE__, _T("Failed to download settings: ") + utf8::cvt<std::wstring>(error)); 
     44        get_logger()->error(__FILE__, __LINE__, _T("Failed to download settings: ") + utf8::to_unicode(error)); 
    4545      } 
    4646      os.close(); 
  • include/settings/settings_core.hpp

    rf14ab71 rf898ded  
    477477    } 
    478478 
    479  
     479    virtual std::list<boost::shared_ptr<settings_interface> > get_children() = 0; 
    480480  }; 
    481481 
  • include/settings/settings_interface_impl.hpp

    rc3f233d rf898ded  
    130130      return core_; 
    131131    } 
    132     const nsclient::logging::logger_interface* get_logger() const { 
     132    nsclient::logging::logger_interface* get_logger() const { 
    133133      return nsclient::logging::logger::get_logger(); 
    134134    } 
    135135 
    136136    void add_child(std::wstring context) { 
    137       MUTEX_GUARD(); 
    138       children_.push_back(get_core()->create_instance(context)); 
     137      try { 
     138        instance_raw_ptr child = get_core()->create_instance(context); 
     139        { 
     140          MUTEX_GUARD(); 
     141          children_.push_back(child); 
     142        } 
     143      } catch (const std::exception &e) { 
     144        get_logger()->error(__FILE__, __LINE__, _T("Failed to load child: ") + utf8::to_unicode(e.what())); 
     145      } 
     146    } 
     147 
     148    virtual std::list<boost::shared_ptr<settings_interface> > get_children() { 
     149      return children_; 
    139150    } 
    140151 
  • service/cli_parser.hpp

    rf14ab71 rf898ded  
    271271      } else { 
    272272        std::cout << all << std::endl; 
     273        client.list_settings_info(); 
    273274        return 1; 
    274275      } 
  • service/settings_client.hpp

    rf14ab71 rf898ded  
    197197      nsclient::logging::logger::get_logger()->debug(__FILE__, __LINE__, msg.c_str()); 
    198198    } 
     199 
     200    void list_settings_context_info(int padding, settings::instance_ptr instance) { 
     201      std::wstring pad = std::wstring(padding, L' '); 
     202      std::wcout << pad << instance->get_info() << std::endl; 
     203      BOOST_FOREACH(settings::instance_ptr child, instance->get_children()) { 
     204        list_settings_context_info(padding+2, child); 
     205      } 
     206    } 
     207    void list_settings_info() { 
     208      std::wcout << _T("Current settings instance loaded: ") << std::endl; 
     209      list_settings_context_info(2, settings_manager::get_settings()); 
     210    } 
    199211  }; 
    200212} 
Note: See TracChangeset for help on using the changeset viewer.