zlog
zlog
FORMULA

The zlog statement outputs a message to the instrumentation log (if instrumentation is enabled).

Parameters

This statement has one parameter:

formula – message to output to log.

Description

This statement outputs a message to the instrumentation log, but only if instrumentation is enabled. If instrumentation is not currently enabled for this procedure, the zlog statement does nothing. See Debug Instrumentation to learn how to configure instruments.

The zlog statement has one parameter, a formula that is used to calculate the message to be sent to the log. In its simplest form, this could simply be a a text constant.

    zlog "Put this into the instrument log."

The message can be any formula that produces a text result. This statement will put the current database name into the log.

    zlog "Current database: "+info("databasename")

It’s very common to display a field or variable value, like this.

    zlog "Customer: "+Customer

To eliminate the need to type in the field or variable name twice, use the labelize( function, like this:

    zlog labelize(Customer)

You can use the labelize( function in a larger formula, even use more than one labelize( function in a single zlog statement.

    zlog labelize(Customer)+", "+labelize(OrderNumber)

Other similar functions you may find useful include labelizeformula( and labelizeinfo(. If you need to send the contents of a dictionary to log, use the zlogdictionary statement instead of zlog.

The zlog statement normally adds a prefix to each line in the log, showing the name of the procedure that contains the zlog statement. For example, if a procedure named New Order contained this code:

    zlog labelize(Customer)+", "+labelize(OrderNumber)

the log output would look something like this:

    [New Order] Customer: Leanne Mathers, OrderNumber: 429

If you don’t want this prefix, start the message with `/-/`, like this:

    zlog "/-/"+labelize(Customer)+", "+labelize(OrderNumber)

With this code, the log output will look like this:

    Customer: Leanne Mathers, OrderNumber: 429

You might find it useful to suppress the prefix if you are creating your own header, for example:

    zlog "/-/=== START OF NEW ORDER PROCEDURE ==="

Remember, you can keep zlog statements in your code permanently. They only output to the log if instrumentation is enabled, which can be done on a procedure-by-procedure basis. So when you aren’t interested in the log output, you can simply turn off instrumentation (see Debug Instrumentation) instead of manually removing all the zlog statements. If you need them again later, they can be enabled in an instant.

See Also

- Client/Server Debug Instrumentation -- using instrumentation with Panorama X server and clients.
- Coding with Debug Instrumentation -- modifying your code to generate debug instrumentation output.
- Crash Proof Debug Instrumentation Monitoring -- real time crash-proof instrumentation monitoring
- Customizing Debug Instrumentation Coverage -- specifying what code is being debugged at the moment.
- Debug Instrumentation -- conditional logging of the internal state of Panorama program code.
- Debug Instrumentation Log Window -- dynamically monitor debug instrumentation output as your program runs.
- Debug Instrumentation Monitoring using an External Program -- monitoring debug instrumentation with an external program (Terminal.app, BBEdit.app).
- Debug Instrumentation Text File -- configuring and accessing the debug instrumentation log (text) file.
- info("runningunderterminal") -- returns the name of the terminal program if Panorama was launched under one, otherwise it returns empty text.
- labelize( -- returns the value of a field or variable along with a label. This saves typing when you need to display fields or variables when logging and debugging.
- labelizeformula( -- returns the value of a formula along with the formula itself as a label.
- labelizeinfo( -- returns the value of an info( function, along with the function itself as a label.
- labelizepattern( -- formats a text value using a label and a pattern.
- Recording Code Triggers in Debug Instrumentation -- the code triggers option automatically tracks whenever any code is triggered, whether from a menu, a button, or implicitly (for example when data is entered).
- Recording Control Flow in Debug Instrumentation -- configure debug instrumentation to automatically log when control flow is non-linear, for example a call, return, goto, etc.
- setzlog -- turns instrumentation coverage on or off for a specific procedure (or all procedures within a database).
- zlogalways -- unconditionally outputs a message to the instrumentation log.
- zlogcoverage -- allows instrumentation coverage to be turned on or off within a procedure.
- zlogdictionary -- outputs a data dictionary to the instrumentation log (if instrumentation is enabled).
- zlogging( -- returns true if zlogging is enabled for the current database and procedure, otherwise false.

History

Version | Status | Notes
10.2 | New | New in this version.