Logging for Unreal SDK
By default all logs are printed to the Unreal Editor's Output Log.
To bind additional functionality, use PubnubSubsystem->OnPubnubError.AddDynamic()
.
- Blueprint
- C++
PubnubSubsystem->OnPubnubError.AddDynamic(this, &UPubNubGameInstance::OnPubnubErrorReceived);
void UPubNubGameInstance::OnPubnubErrorReceived(FString ErrorMessage, EPubnubErrorType ErrorType)
{
// Do something with the error
}
Error handling with logging
The PubNub Unreal SDK provides an error handling system that complements the logging capabilities.
Binding to error events
- Blueprint
- C++
//PubNubGameInstance.h
// NOTE: This example requires correct PubnubSDK configuration in plugins settings and adding "PubnubLibrary" to PublicDependencyModuleNames in your build.cs
// More info in the documentation: https://www.pubnub.com/docs/sdks/unreal/api-reference/configuration
#pragma once
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "PubnubSubsystem.h"
#include "PubNubGameInstance.generated.h"
UCLASS()
//Replace YOUR_PROJECT_API with [Project_Name]_API
class SDKSTEST_API UPubNubGameInstance : public UGameInstance
{
GENERATED_BODY()
show all 62 linesChecking response status in callbacks
Many SDK methods return status codes that you can use to log success or failure.
- Blueprint
- C++
// MyGameMode.h
// NOTE: This example requires correct PubnubSDK configuration in plugins settings and adding "PubnubLibrary" to PublicDependencyModuleNames in your build.cs
// More info in the documentation: https://www.pubnub.com/docs/sdks/unreal/api-reference/configuration
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "MyGameMode.generated.h"
/**
*
*/
UCLASS()
//Replace MYPROJECT with name of your project
show all 85 linesViewing logs
Logs generated by the PubNub Unreal SDK can be viewed in:
- Unreal Editor's Output Log window during development (Window → Developer Tools → Output Log).
- Debug console when running a packaged game with the console enabled.
- Log files located in your project's Saved/Logs directory.