[Feuture request] conditional parameters in StringParameterSubstitution

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Feuture request] conditional parameters in StringParameterSubstitution

Reinout Heeck-2
In our application we need to be precise with what we log, sometimes
simple things like order IDs are private to certain users and may not be
logged in other peoples installations.

We make a lot of use of StringParameterSubstitution for our logging and
we miss the possibility to conditionally expand a parameter.

Currently we can write
   '<1?foo:>'
to conditionally expand a constant string but I would like to be able to
also use something like
   'Order<1? with ID <2s>:> received'
to conditionally expand the parameter #2.

Now we need to use constructs like
  str := isPrivate
            ifTrue: [ 'Order with id <1s> received' expandMacrosWith: ...]
            ifFalse: ['Order received'].

which get out of hand if multiple clauses are conditional.


TIA,

Reinout Heeck
-------------

Reply | Threaded
Open this post in threaded view
|

RE: [Feuture request] conditional parameters in StringParameterSubstitution

Thomas Brodt
Hi Reinout,

we currently did this using the Substitution for a second time.  
So our Message strings are  'Order<1? with ID %<2s%>:> received' which escapes the interior markers with %. The result of the first
expandMacros-call is then passed again to the machinery which then resolves the interior markers if still present. (Effectively,
this is done as often as needed until no more marks are left).

'Order<1? with ID %<2s%>:> received'
   => 'Order with ID <2s> received'
      => 'Order with ID 12345 received'

or if private

'Order<1? with ID %<2s%>:> received'
   => 'Order received'

This works well, just the strings get more and more unreadable the more nesting is done.
HTH

Thomas

> -----Original Message-----
> From: Reinout Heeck [mailto:[hidden email]]
> Sent: Monday, August 28, 2006 3:51 PM
> To: 'VWNC'
> Subject: [Feuture request] conditional parameters in
> StringParameterSubstitution
>
> In our application we need to be precise with what we log, sometimes
> simple things like order IDs are private to certain users and
> may not be
> logged in other peoples installations.
>
> We make a lot of use of StringParameterSubstitution for our
> logging and
> we miss the possibility to conditionally expand a parameter.
>
> Currently we can write
>    '<1?foo:>'
> to conditionally expand a constant string but I would like to
> be able to
> also use something like
>    'Order<1? with ID <2s>:> received'
> to conditionally expand the parameter #2.
>
> Now we need to use constructs like
>   str := isPrivate
>             ifTrue: [ 'Order with id <1s> received'
> expandMacrosWith: ...]
>             ifFalse: ['Order received'].
>
> which get out of hand if multiple clauses are conditional.
>
>
> TIA,
>
> Reinout Heeck
> -------------
>
>