-
Notifications
You must be signed in to change notification settings - Fork 244
SDL Logging levels
The are 6 logging levels in SDL implementation:
Indicates, that SDL has an abnormal problem and will be stopped (or shut down) immediately. It also can mean that the current status is UB or SDL was interrupted with SegFault.
if (!life_cycle.InitMessageSystem()) {
SDL_FATAL("Failed to init message system");
life_cycle.StopComponents();
exit(EXIT_FAILURE);
}
Shows, that an error occurred and SDL has not accomplished some internal or API activities, but this error was correctly handled and SDL continued working
// DeleteCommandRequest
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
SDL_ERROR("Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
Warns against a not commonplace, but expected behavior, which was successfully handled by SDL.
// ProtocolHandlerImpl
if (result == RESULT_MALFORMED_OCCURS) {
SDL_WARN("Malformed message occurs, connection id " << connection_key);
...
}
Informs SDL's user, integrator or support engineer about the current component high-level activity success.
// ConnectionHandlerImpl
SDL_INFO("Disconnect flooding application");
CloseSession(connection_handle, session_id, kFlood);
// MediaManagerImpl
SDL_INFO("StartMicrophoneRecording to " << output_file);
// PolicyManagerImpl
SDL_INFO("Policy table updated from " << (b ? "cloud" : "preloaded") << path);
// TransportManager - TcpClientListener
const utils::HostAddress client_address = client_connection.GetAddress();
SDL_INFO("Connected client " << client_address.ToString() << ":"
<< client_connection.GetPort());
Is a devlopers-only information, which can help to debug an issue by log
// ProtocolHandlerImpl
SDL_DEBUG("Protocol version: " << packet.protocol_version());
// ProtocolHandlerImpl
SDL_DEBUG("Frequency of " << connection_key << " is " << message_frequency);
// SecurityManagerImpl
if (sslContext->IsInitCompleted()) {
SDL_DEBUG("SSL initialization finished success.");
NotifyListenersOnHandshakeDone( connection_key,
SSLContext::Handshake_Result_Success);
}
Low-level tracing information. The common places for TRACE macro is - expected cases of switch, return. beginning or/and end of code block: method, if-else statement
// ProtocolHandlerImpl
switch (packet->frame_type()) {
case FRAME_TYPE_CONTROL:
SDL_TRACE("handleMessage() - case FRAME_TYPE_CONTROL");
return HandleControlMessage(connection_id, packet);
...
}
// Utils - Thread
if (isThreadRunning_) {
SDL_TRACE("EXIT thread "<< name_ << " #" << handle_ << " is already running");
return true;
}
// TransportManagerDefault::Init
SDL_TRACE("exit with E_SUCCESS");
return E_SUCCESS;
There is a common situation, when pretty hard to choose between two nearby levels. In this case use the lower level.