Sunday, March 28, 2010

What is this method sop()?

wsadminlib.py has a rudimentary trace/logging facility in method sop(). The name is a snarky acronym taken from Java's System.out.println() command.

Input: Method sop() takes two strings as parameters, the name of the calling method, and the message.

Output: Method sop() prints these to the console, along with a terse, internationally-understandable timestamp: [YYYY-MMDD-hhmm-ss00]

You can turn these messages on and off dynamically by calling these toggle methods:
- enableDebugMessages()
- disableDebugMessages()
sop() messages are disabled by default. I like verbose messages, so all of my scripts call enableDebugMessages() right at the start.

Note that wsadminlib contains many calls to sop() which are commented-out. These are usually very verbose messages which were written by the original method developer, but not needed since. However, we left them in intentionally. If you are having trouble making a specific method work, or you want to see the gory details for use in your own method, try uncommenting some of these messages for extra hints.

Oh, and one more thing. You can call method sop() from your own script files as well. That way, your messages will have the same fancy timestamp as wsadminlib's, and your messages will look consistent with wsadminlib's too (which I find makes everything easier to read).