Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 LogTemp and Warning not autocomplete in UE
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Jorge24
Junior Member

USA
24 Posts

Posted - Jun 25 2020 :  02:20:23 AM  Show Profile  Reply with Quote
In Unreal Engine, Epic's preferred way to print out logs to the UE console is to use:

UE_LOG(LogTemp, Warning, TEXT("text to print"));


However, Visual Assist does not autocomplete the log category like "LogTemp" nor verbosiy like "Warning".







It does autocomplete other log verbosities like "Display" and "Error" such as
UE_LOG(LogTemp, Error, TEXT("text to print"));


On the other hand, Visual Studio's intellisense is able to autocomplete LogTemp.

I have tried this using the Unreal Engine 4.25.1 installed from the Epic Launcher.

As I was writing this post I learned to use the VA snippet feature and realized I can use it to pop up an entire log template which makes things easier and faster than typing each word with autocomplete. So, this missing autocomplete here is not really an issue anymore. Still, I decided to post this since I had already started typing it.

feline
Whole Tomato Software

United Kingdom
16776 Posts

Posted - Jun 26 2020 :  07:19:56 AM  Show Profile  Reply with Quote
As a temporary work around, can you please go to VA options and press the button:

VA Options -> Performance -> Rebuild symbol databases

and now close all open instances of Visual Studio.

Before reloading Visual Studio, and letting VA start rebuilding its symbol database please go to the root directory of your Unreal Engine solution, where the .SLN file lives. In this directory create a new text file called:

va_stdafx.h

and edit this file, giving it the content:

#define DEFINE_LOG_CATEGORY(LOG_CATEGORY) enum { LOG_CATEGORY };

making sure the file ends with a blank line, and saving it out. VA automatically looks for this file next to the SLN file, and if found, parses it before it starts parsing anything else for this solution.

This should tell VA how to understand all of the log types that are being defined, but not currently known. Unfortunately it does require a VA symbol database rebuild to take effect, which will take several minutes since VA has to parse all of Unreal Engine, plus your game solution as well.

Since this file is not part of the solution, and it is something that VA looks for directly, it is safe to check it into source control.

Does this fix the problem for you?

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16776 Posts

Posted - Jun 26 2020 :  11:33:06 AM  Show Profile  Reply with Quote
I think I know why the second parameter is not being suggested by VA, but I am not sure what to do about this. It looks like these logging flags are set in the file "LogVerbosity.h"

\Engine\Source\Runtime\Core\Public\Logging\LogVerbosity.h

which has, in summary:

namespace ELogVerbosity
{
    enum Type : uint8
    {
		Error,
		Warning, // the rest
    };
}

so, when typing "Warning" in the UE_LOG macro call, this does not appear to be in scope. I assume it is in scope, but I have not yet found the using namespace line, or equivalent, that makes this happen.

Simply adding these enum items as global Unreal Engine symbols should solve your problem, but do we want to do this?

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16776 Posts

Posted - Jul 01 2020 :  09:58:56 AM  Show Profile  Reply with Quote
As a work around, can you please try adding the following code to your "va_stdafx.h" file:

#define DEFINE_LOG_CATEGORY(LOG_CATEGORY) enum { LOG_CATEGORY };
enum UE_LOG_TYPE { NoLogging = 0, Fatal, Error, Warning, Display, Log, Verbose, VeryVerbose, All, NumVerbosity, VerbosityMask, SetColor, BreakOnLog };
void UE_LOG(int CatgeoryName, UE_LOG_TYPE Verbosity, TCHAR *Format, ...);
void UE_CLOG(int Condition, int CatgeoryName, UE_LOG_TYPE Verbosity, TCHAR *Format, ...);

making sure that the file ends with a blank line. After a VA symbol database rebuild this should help with VA understanding and suggesting the second parameter.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16776 Posts

Posted - Jul 01 2020 :  10:53:30 AM  Show Profile  Reply with Quote
case=117086

zen is the art of being at one with the two'ness
Go to Top of Page

Jorge24
Junior Member

USA
24 Posts

Posted - Jul 10 2020 :  03:48:13 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

As a work around, can you please try adding the following code to your "va_stdafx.h" file:

#define DEFINE_LOG_CATEGORY(LOG_CATEGORY) enum { LOG_CATEGORY };
enum UE_LOG_TYPE { NoLogging = 0, Fatal, Error, Warning, Display, Log, Verbose, VeryVerbose, All, NumVerbosity, VerbosityMask, SetColor, BreakOnLog };
void UE_LOG(int CatgeoryName, UE_LOG_TYPE Verbosity, TCHAR *Format, ...);
void UE_CLOG(int Condition, int CatgeoryName, UE_LOG_TYPE Verbosity, TCHAR *Format, ...);

making sure that the file ends with a blank line. After a VA symbol database rebuild this should help with VA understanding and suggesting the second parameter.



Hi, thanks for the workaround. I tried that and it fixed one of the two. Now I get autocomplete for the verbosity like Warning/Display/Error but I still don't get autocomplete for the log category like "LogTemp"
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16776 Posts

Posted - Jul 11 2020 :  09:47:33 AM  Show Profile  Reply with Quote
I think I have a good work around for the log category, but I don't know what items this should contain by default.

Having VA search for and list all known log categories is not a good idea, just inside unreal engine its self I am finding 650 different log categories. Not a listbox you really want to be working with if you don't have to.

Can you please try changing your va_stdafx.h file to use the following code instead:

#define DEFINE_LOG_CATEGORY(LOG_CATEGORY) enum { LOG_CATEGORY };
enum UE_LOG_TYPE { NoLogging = 0, Fatal, Error, Warning, Display, Log, Verbose, VeryVerbose, All, NumVerbosity, VerbosityMask, SetColor, BreakOnLog };
enum UE_LOG_CATEGORY_TYPES { LogTemp, LogText, LogNet, LogPath };
void UE_LOG(UE_LOG_CATEGORY_TYPES CatgeoryName, UE_LOG_TYPE Verbosity, TCHAR *Format, ...);
void UE_CLOG(int Condition, UE_LOG_CATEGORY_TYPES CatgeoryName, UE_LOG_TYPE Verbosity, TCHAR *Format, ...);


this tells VA that there are 4 possible log categories:

LogTemp,
LogText,
LogNet,
LogPath

but if you can tell me which ones should be in the default list, this would be helpful.

To avoid having to rebuild your VA symbol database all of the time, now open the VA Snippet editor, and copy / paste in the following XML block, which will create a new VA Snippet:

<VA_Snippet>
<Language>C++</Language>
<Title>SuggestionsForType UE_LOG_CATEGORY_TYPES</Title>
<Shortcut />
<Description>User defined smart suggestion list for first parameter to UE_LOG
</Description>
<Code>LogAnalytics
LogAnimation
LogDamage
LogProperty</Code>
</VA_Snippet>


which will be a C++ Smart Suggestions type snippet. VA will add these entries to the default list of log category types that are suggested. So you can easily edit this snippet to add any log types you want suggested, and this should take effect immediately.

Again, any suggestions for good default items here would be rather helpful.

zen is the art of being at one with the two'ness
Go to Top of Page

Jorge24
Junior Member

USA
24 Posts

Posted - Jul 11 2020 :  8:19:12 PM  Show Profile  Reply with Quote
Thank you for replying again. The way log categories are used is that you define your own custom categories in your header and cpp file but sometimes you use LogTemp for things that you haven't made a category for or if it's a log you're only using temporarily. As long as LogTemp shows up among the other user defined log categories, I think it is fine. I don't use other UE default log categories besides LogTemp. However, the other problem is that my user defined logs dont show up in the intellisense autocomplete.

For example, in the header file you declare it:



and then in your cpp file you define it and use it:

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16776 Posts

Posted - Jul 13 2020 :  09:39:00 AM  Show Profile  Reply with Quote
Since DEFINE_LOG_CATEGORY, and all of the log calls I have checked, are macros, this limits our ability to make sensible suggestions. VA is parsing the code before the macros are expanded, and at this point they don't have type information.

I had not even noticed DECLARE_LOG_CATEGORY_EXTERN yet, so this is not being handled by these work arounds either.

In an ideal world, what would you have VA do here?

The VA Snippet I listed above can easily be used to add your custom log categories to the listbox that VA will produce when calling UE_LOG, but this will be a global list, so it will always suggest all of these log categories in all of your files.


Looking up what DECLARE_LOG_CATEGORY_EXTERN should do gets me to the page:

https://docs.unrealengine.com/en-US/API/Runtime/Core/DECLARE_LOG_CATEGORY_EXTERN/29/index.html

which is actually just an "empty" page. It just asks me which category of UE documentation I want to read. I get the same result on different browsers and machines, so I don't think it is a browser problem at my end.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000