Enum or Constants for Logging in Mendix - Your Preference?

1
Hi all, Quick one for the Mendix experts: when it comes to creating log nodes in the module, do you prefer using enums or constants? Any specific advantages or pitfalls with either approach? can someone also point me to Mendix Best Practice on this. Appreciate your insights! 🚀
asked
2 answers
2

Personally I like using enums:

 

  • I never change lognode names after the fact, so it's not necessary to have them in a constant and clog up my already long list of constants in the deployment options of my app
  • It allows me to set multiple lognode names in a single module if needed without adding more documents
  • Typing the lognode enum name and hitting ctrl+space in an expression editor gives you all lognode options for this module in an easy way.

I've seen both used and both are valid options in my opinion.

 

(This type of question is probably better suited for the "exchanges" part of the forum, good to now for future questions that don't really have an accepted answer)

answered
0

Hello Gorakshanath, 

 

Good question  I am also curious!

 

In my opinion constants are more flexible in their set up because you can use a different value per environment, on the other hand this is more administrative. 

I prefer to use enumeration because it is less administration, but if you really need to be specific for with logging i would advice to use the Constant.

 

Good luck !

 

 

answered