# Wiki Code Tutorials

**URL:** <https://forums.unrealengine.com/t/wiki-code-tutorials/256>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [March 20, 2014, 9:39pm UTC](https://forums.unrealengine.com/t/wiki-code-tutorials/256 "2014-03-20T21:39:34Z")\
**Posts on this page:** 1\
**Showing post:** 220

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [January 23, 2015, 6:00am UTC](https://forums.unrealengine.com/t/wiki-code-tutorials/256/220 "2015-01-23T06:00:50Z")

</div>

Dear Community,

I’ve just posted a new wiki!

I am giving you easy-to-use pre-processor commands to get a UE4 String that tells you the Class Name, Function Name, and Line Number of the calling code!

**Logs, Printing the Class Name, Function Name, and Line Number of your Calling Code!**  
[https://wiki.unrealengine](https://wiki.unrealengine)./Logs,\_Printing\_the\_Class\_Name,\_Function\_Name,\_Line\_Number\_of\_your\_Calling\_Code!#My\_C.2B.2B\_Code\_For\_You

````auto

**Pics**

![a51b4eb12a773cd47ef504c3015401ed5a1222f7.jpeg|1280x960](upload://nyBhSL7AeJYRaiuAA8hU6eu26hN.jpeg)

After you get my .h file below, the code for the above picture is !

```

// ~~~Tick~~~
void AEVCoreDefense::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	// ~~~~~~~~~~~~~

	VSCREENMSG("Got Here!"); //Class and line number get printed for you! ♥ 
}

```

![76592038c1a622532653d3516d343bb88787467e.jpeg|1280x960](upload://gSXi9wvKFnU8eJKryUDfNDEi8eG.jpeg)

````

**Code**

**Here is the entire file you can #include in your code base!**

I made a file called JoyCurrentClassFuncLine.h

So you would then do somewhere at the top of one of your core classes:

```auto

// Joy Class Func Line
**#include "JoyCurrentClassFuncLine.h"**

```

```auto

**/*
	Joy String 
		Current Class, File, and Line Number!
			by
			
	PreProcessor commands to get 
		a. Class name
		b. Function Name
		c. Line number 
		d. Function Signature (including parameters)
		
	Gives you a UE4 FString anywhere in your code that these macros are used!
	
	Ex: 
		You can use JOYSTR_CUR_CLASS anywhere to get a UE4 FString back telling you 
		what the current class is where you called macro!
	
	Ex:
		macro prints the class and line along with the message of your choosing!
		VSCREENMSG("Have fun today!");
	<3 
*/**
#pragma once

**//Current Class Name + Function Name where is called!**
#define JOYSTR_CUR_CLASS_FUNC (FString( __FUNCTION__ ))

**//Current Class where is called!**
#define JOYSTR_CUR_CLASS (FString( __FUNCTION__ ).Left(FString( __FUNCTION__ ).Find(TEXT(":"))) )

**//Current Function Name where is called!**
#define JOYSTR_CUR_FUNC (FString( __FUNCTION__ ).Right(FString( __FUNCTION__ ).Len() - FString( __FUNCTION__ ).Find(TEXT("::")) - 2 ))
  
**//Current Line Number in the code where is called!**
#define JOYSTR_CUR_LINE (FString::FromInt( __LINE__ ))

**//Current Class and Line Number where is called!**
#define JOYSTR_CUR_CLASS_LINE (JOYSTR_CUR_CLASS + "(" + JOYSTR_CUR_LINE + ")")
  
**//Current Function Signature where is called!**
#define JOYSTR_CUR_FUNCSIG (FString( __FUNCSIG__ ))

**//Victory Screen Message
// Gives you the Class name and exact line number where you print a message to yourself!**
#define VSCREENMSG(Param1) (GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *(JOYSTR_CUR_CLASS_LINE + ": " + Param1)) )

```

---

_[View the full topic](https://forums.unrealengine.com/t/wiki-code-tutorials/256)._
