Fork me on GitHub

Provide a PostNuke logging function  Bottom

  • I just submitted this request:
    http://noc.postnuke.…group_id=5&atid=104

    Here is the text:

    It would be helpful to developers and administrators
    if there was a PostNuke logging facility available.
    For example, from a module, block, or theme you could
    call:

    pnLogger("Admin: lookup", "No record found");

    The first parameter is a meaningful key.
    The second parameter is the actual log information.
    Additional information (timestamp, userid, ...) would
    be filled in by the pnLogger function and stored in an
    SQL table.

    Logging could be used to trace modules that cause PN
    crashes during development. Exceptions, unusual
    conditions, security hacks could also be logged.
    Anything that was unnecessary for the end user to see.
  • boy - I wish I had the time, that seems like it would be an easy module to write. Then someone would need to campaign to get it into the core. Maybe if I get a few hours next week. maybe. maybe.
  • If you need some help, I'm here for you!

    I could write the module but... I would really like to see it in PostNuke itself. Maybe with a little direction from the PN developers we could make this happen.
  • If you can, I suggest you do so. I don't think it would be that difficult because it would be a module that provides functionality, but content. I would pattern it after many of the NS-*** modules. Then the API would just provide the pnLogger() function you mention. Then for a mod-dev to use it, they would load the API and call the function. (At least I think that is how it should work - maybe Mark would have some input.... MARK!!?!?!?! :))
  • A generic event logger seems like a useful addon for all sorts of things. I'd need to see a more in depth proposal but like the general idea. At this stage I can only offer advice as i've 101 other things going on.

    Any module should be fully pnAPI compliant. Thus not in any way based on NS-* modules which are non-API compliant and prefixed with that nasty, nasty NS- prefix which is dropped for .8.

    -Mark
  • I really would prefer a PN function call (i.e. a pnAPI) as opposed to a module call. This avoids the need to load/initialize/whatever.

    This way you could for example put:

    Code

    pnLogger("Admin: lookup", "No record found");

    anywhere in your theme/block/module. Simple and useful, without any other overhead.
  • An API would be ok but given that'd we would need a module control panel it makes sense to modularise it. The API would only be a wrapper to the module and fallback to setting the error message session var if not. i.e.

    Code

    function pnLogger($errtype, $errno, $errseverity, $errmsg.....)
    {
        $return = false;
        if (pnModAvailable('pnLogger') && pnModAPILoad('pnLogger', 'user)) {
           $return = pnModAPIFunc('
    pnLogger', 'user', 'logerror', array(.....));
        }
        if ($return == false) {
           pnSessionSetVar('
    errormsg', $errtype . ':' . $errmsg ......);
        }
    }


    The other thing to consider would be the visual presentation of errors. In the .8 cvs we have the basic construct of an errors module for the visual display of errors - this would need to be linked in to here somehow - perhaps an additional flag to display the error message.

    -Mark
  • Makes sense to me. I will register 'pnLogger' at the NOC.

    I would like to here suggestions about what sould be included in this module. I realize it is fairly simple module but I don't want to assume anything. My first criteria: Keep it simple.

    Thanks for the feedback so far!
  • Follow the 'keep it simple' approach. Via pnModAPI* calls further modules can interact. To my mind a module should do one thing and do it well. Anything else is a complication.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • What ever happened to the idea of providing a system-wide logger in postnuke core? Surely, webmasters are using some kind of logger for system messages in the PostNuke unstallations, no? How are you folks doing so? I found pnLogger module, but it's in beta. Thoughts, anybody?
    :?:
  • pnLogger is my next project after finishing up with the RemoteBlock module. Functionally it won't change much, I just plan to convert the interface to templates and release v1.0. Use it and send me some feedback.

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