Fork me on GitHub

LogUtil:: documentation? usage?  Bottom

  • Is there any documentation of LogUtil that I am missing? I have looked and found nothing. I can figure out the inline docs within the class, but my real question is this: Is LogUtil the way of the future? Is this this intended way to register module errors to the admin/user? It has been a while, but I thought I remembered some other way to do so in the past...

    A page in the Wiki from some of our lead developers regarding which technologies/APIs we should be using as module developers would be helpful. e.g. "use LogUtil instead of SessionUtil to do xxx and yyy, but not zzz" would be helpful not only for LogUtil, but for any and all technologies present and planned would be great.

    thanks!
  • Quote

    Is LogUtil the way of the future?

    Yes. The API should remain in place and it is the official thing to use since ZK 1.0. It is used throughout the core and in up-to-date 3rd party modules.

    Quote

    use LogUtil instead of SessionUtil to do xxx and yyy, but not zzz

    You should use LogUtil::registerError() to display a red error to the user (which is displayed upon the next pageload).

    You should use LogUtil::registerStatus() to display a green status message to the user (which is displayed upon the next pageload).

    You should use LogUtil::registerPermissionError() to report permission errors (which is just an API wrapper around LogUtil::registerError()

    You should use SessionUtil::* to store/load/delete module data that you need to persist behind the screens to session. For complex things is is much better than posting hidden variables or passing URL parameters.


    You can configure LogUtil to write errors to a log file, but this is really only useful for debugging since these files can get very large. That part of LogUtil should be disabled in a productive setting. For most debugging situations just doing a print() and/or prayer() is faster/easier but there are some situations (such as requests triggered from remote sites where no output is displayed in your browser, some Ajax things) which make this part of LogUtil nice to have.

    Hopefully that at least partially answers your questions. Yes, someone should write a Wiki page about this ...

    Greetings
    R
  • thanks! If I get a minute, I'll try to post this information to the Wiki... unless you beat me to it! icon_wink
  • Quote

    (which is displayed upon the next pageload)

    should the results be displayed on any pageload? or only admin page loads? my module doesn't seem to display the results but when I go back to another page, I can seem them there. What do I need to insert in my template code?

This list is based on users active over the last 60 minutes.