MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / ApiSetLoggingLevel

Function ApiSetLoggingLevel

zone/api_service.cpp:848–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846}
847
848Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
849{
850 if (zone->GetZoneID() == 0) {
851 throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
852 }
853
854 Json::Value response;
855
856 auto logging_category = params[0].asInt();
857 auto logging_level = params[1].asInt();
858
859 response["status"] = "Category doesn't exist";
860
861 LogInfo("Logging category is [{}] and level is [{}]",
862 logging_category,
863 logging_level
864 );
865
866 if (logging_category < Logs::LogCategory::MaxCategoryID &&
867 logging_category > Logs::LogCategory::None
868 ) {
869 EQEmuLogSys::Instance()->log_settings[logging_category].log_to_console = logging_level;
870 response["status"] = "Category log level updated";
871 }
872
873 if (logging_level > 0) {
874 EQEmuLogSys::Instance()->log_settings[logging_category].is_category_enabled = 1;
875 }
876 else {
877 EQEmuLogSys::Instance()->log_settings[logging_category].is_category_enabled = 0;
878 }
879
880 return response;
881}
882
883void RegisterApiLogEvent(std::unique_ptr<EQ::Net::WebsocketServer> &server)
884{

Callers

nothing calls this directly

Calls 3

WebsocketExceptionClass · 0.85
asIntMethod · 0.80
GetZoneIDMethod · 0.45

Tested by

no test coverage detected