What is the correct way to create a SMessageLogListing? I’ve tried the following, but it doesn’t appear in the Message Log drop down list of possible logs.
FMessageLogModule& MessageLog =
FModuleManager::LoadModuleChecked(
TEXT("MessageLog"));
MyLog = SNew(SMessageLogListing, MessageLog.GetRegisteredLogListingModel("MyLog"))
.HeaderRow
(
SNew(SHeaderRow)
+ SHeaderRow::Column("Message").DefaultLabel(TEXT("Message"))
);
auto mylogref = MyLog.ToSharedRef();
MessageLog.RegisterLogListingView(mylogref);
First of all, let me apologize for the state that the message log is in. It’s been in need of a serious refactor for a long time. Currently, setting up a new message log listing to way too much work. If you look at FLoadErrors, this is the simplest way to set up a (global) message log. Below is the source to the CreateLogListingView for FLoadErrors.
bool FLoadErrors::CreateLogListingView()
{
FMessageLogModule& MessageLogModule = FModuleManager::LoadModuleChecked("MessageLog");
if ( MessageLogModule.IsRegisteredLogListingView( GetName() ) )
{
return false;
}
TSharedRef LogListingModel = MessageLogModule.GetRegisteredLogListingModel( GetName() );
LogListingModel->SetLabel( LOCTEXT("LoadErrors", "Load Errors") );
TSharedPtr LogListingView;
// Create the layout of this in the log listing
SAssignNew(LogListingView, SMessageLogListing, LogListingModel)
.HeaderRow( CreateHeaders() );
TSharedRef LogListingViewRef = LogListingView.ToSharedRef();
return MessageLogModule.RegisterLogListingView(LogListingViewRef);
}
You’ll also need to call something like FLoadErrors::Get().CreateLogListingView(); and FLoadErrors::Get().DestroyLogListingView(); or your module startup and shutdown.
Again, this is extremely heavyweight, so I must emphasize that this process will be simplified greatly in later releases.
Ahh - so close. Showing up now, thanks Zane!
Also, no need to apologize - this is a beta after all.