# Clear output log?

**URL:** <https://forums.unrealengine.com/t/clear-output-log/37666>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [August 5, 2015, 6:21pm UTC](https://forums.unrealengine.com/t/clear-output-log/37666 "2015-08-05T18:21:26Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![Omar\_Nader](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/omar_nader/32/968940_2.png) [@Omar\_Nader](https://forums.unrealengine.com/u/Omar_Nader)\
**Post date:** [May 8, 2024, 7:20am UTC](https://forums.unrealengine.com/t/clear-output-log/37666/17 "2024-05-08T07:20:05Z")

</div>

I know this thread is a bit old, but I’ve figured out a way to clear the output log using C++, it requires some setup though…

in _"YourProjectName"Editor.Target.cs_ file, add _“OutputLog”_ module to public and private dependency names as follows:

```auto
.
.
.
		PublicDependencyModuleNames.AddRange(new string[]
		{
			"OutputLog",
		});
		
		PrivateDependencyModuleNames.AddRange(new string[]
		{
			"OutputLog",
		});
.
.
.

```

Declare a static function in a blueprint function library…

**UMyBlueprintFunctionLibrary.h**

```auto
UCLASS()
class YourProjectName_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

	UFUNCTION(BlueprintCallable)
	static void ClearOutputLog();
}

```

Now, in the respective .cpp file, it’s important to add the following dependencies:  
_(otherwise, the UBT will throw linking errors)_

```auto
#include "OutputLog/Public/OutputLogModule.h"
#include "Developer/OutputLog/Private/SOutputLog.h"
#include "Developer/OutputLog/Private/SOutputLog.cpp"
#include "Developer/OutputLog/Private/OutputLogStyle.h"
#include "Developer/OutputLog/Private/OutputLogStyle.cpp"

```

Next, implement the static function as follows:

```auto
void UMyBlueprintFunctionLibrary::ClearOutputLog()
{
	// Check if the module is loaded before accessing it...
	if (FModuleManager::Get().IsModuleLoaded("OutputLog"))
	{
		const FOutputLogModule& OutputLogModule = FModuleManager::GetModuleChecked< FOutputLogModule >(TEXT("OutputLog"));
		
		// Cast the underlying slate of OutputLogModule to SOutputLog...
		if (const auto OutputLog = StaticCastSharedPtr<SOutputLog>(OutputLogModule.GetOutputLog()); OutputLog.IsValid())
		{
			// Clear the output log...
			if (OutputLog->CanClearLog())
			{
				OutputLog->OnClearLog();
			}
		}
	}
}

```

That’s all.

You could then call this function in your code or blueprints whenever you want the OutputLog to be cleared.

I hope this helps 🙂

---

_[View the full topic](https://forums.unrealengine.com/t/clear-output-log/37666)._
