如何更改AX信息消息的级别 [英] How to change the level of AX info messages
问题描述
在Dynamics AX 2009中,我试图确定信息消息的缩进级别.我想要的是与此类似的东西:
In Dynamics AX 2009 I am trying to determine the level of indentation of an info message. What I want is something similar to this:
Prefix
Info1
Info2
Prefix2
Info3
我发现了:
http://www.doens.be/2010/05/the -ax-infolog/
但是不想使用循环,所以我认为类似的事情可能有用:
But don't want to use a loop, so I thought something like this might work:
setprefix("Prefix");
{
info("Info1");
info("Info2");
}
setprefix("Prefix2");
{
info("Info3");
}
但事实并非如此.在x ++中有没有办法做到这一点?关于当前处于何种缩进级别的规则是什么?
But it doesn't. Is there a way to do this in x++, and what are the rules as to what indent level is currently active?
推荐答案
setPrefix
在AX中设置当前执行范围的前缀(adds),当离开范围时,前缀会自动重置为上一个级别.您可以使用getPrefix
检查当前执行前缀.
setPrefix
in AX sets (adds) the prefix for the current execution scope, and when leaving the scope the prefix is automatically reset to the previous level. You can use getPrefix
to check the current execution prefix.
2个骇客可以帮助您获得预期的结果:
2 hacks can help you recieve the expected result:
#1
static void TestJob(Args _args)
{
void sub1()
{
setprefix("Prefix");
info("Info1");
info("Info2");
}
void sub2()
{
setprefix("Prefix2");
info("Info3");
}
;
setPrefix("Main");
sub1();
sub2();
}
#2
static void TestJob(Args _args)
{
setPrefix("Main");
info("Prefix\tInfo1");
info("Prefix\tInfo2");
info("Prefix2\tInfo3");
}
这篇关于如何更改AX信息消息的级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!