Log functions
-------------


.. index:: Macro function;fn.log

* *fn.log*: Given a log level and message, display  
  it in the log. Log levels can be:       
  debug, critical, warn, error or info.   

.. index:: Macro function;fn.txn_log

* *fn.txn_log*: Given a message, display it in the      
  transaction log on the Admin Portal.             

  The macro is typically added to a       
  workflow "Set" step for debugging       
  purposes.                               


.. rubric:: Examples:


.. tabularcolumns:: |p{8cm}|p{7cm}|


+-----------------------------------+-----------------------------------------------+
|  Example                          | Output                                        |
+===================================+===============================================+
| ::                                | In ``app.log``:                               |
|                                   |                                               |
|    {{fn.log info,                 | ::                                            | 
|      This is an                   |                                               |
|      informational message.}}     |   INFO This is an informational               |
|                                   |   message.                                    |
|                                   |                                               |
|    {{fn.log debug,                |                                               |
|      Debug message.}}             |   DEBUG Debug message.                        |
|                                   |                                               |
+-----------------------------------+-----------------------------------------------+
| A workflow (1PWF) step Set        |   Step 1 - Set workflow context (1PWF):       |
| variable "bar" is a message with  |                                               |
| the value of "name".              |                                               |
|                                   |                                               |
|                                   |                                               |
| ::                                |                                               |
|                                   | ::                                            |
|    {{fn.txn_log pwf.name}}        |                                               | 
|                                   |    {                                          |
|                                   |      "set_list": [                            |
|                                   |          {                                    |
|                                   |              "set_var_name": "name",          |
|                                   |              "set_var_value": "foo"           |
|                                   |          },                                   |
|                                   |         {                                     |
|                                   |             "set_var_name": "bar",            |
|                                   |             "set_var_value":                  |
|                                   |             "{{fn.txn_log pwf.name}}"         |
|                                   |         }                                     |
|                                   |       ],                                      |
|                                   |       "bar": "foo",                           |
|                                   |       "name": "foo"                           |
|                                   |    }                                          |
+-----------------------------------+-----------------------------------------------+

For examples of the macros below, refer to the example for Custom Messages and
Details in Provisioning Workflows.

* ``fn.set_current_transaction_detail(<detail_text>)``

  To customize the transaction detail of the *current* transaction: top (ancestor)
  or child transaction. If a transaction fails, this detail will also override the
  standard detail.

* ``fn.set_top_level_transaction_detail(<detail_text>)``

  To customize the transaction detail of the top (ancestor) transaction. If there
  is no top transaction, it will customize the current transaction detail. If a
  transaction fails, this detail will also override the standard detail.

* ``fn.set_current_transaction_message(<message_text>)``

  To customize the transaction message of the *current* transaction: top or child
  transaction. If a transaction fails, this message will *not* override the standard
  error message.
  
* ``fn.set_top_level_transaction_message(<message_text>)``

  To customize the transaction message of the top transaction. If there is no top
  transaction, it will customize the current transaction message. If a transaction
  fails, this message will *not* override the standard error message.



.. |VOSS Automate| replace:: VOSS Automate
.. |Unified CM| replace:: Unified CM
