Fork me on GitHub
Current Releases are 2.1 stable (major release) and 2.0.18.11 (security patch for 2.0)
We've also rebooted our GitHub repo, docs, and more!

Is there a Logger in Vanilla?

edited March 2012 in Questions

Hi again,
I'm still developing my first plugin and I need to log some messages during execution, but I couldn't figure out if there's a logging function/module in Vanilla. I see there's a gdn_log table, but, in my installation, it's always empty no matter what happens. Should I configure/install something in particular? Thanks.

Best Answer

  • x00x00 MVP
    Answer ✓

    have a look at dashboard/class.logmodel.php

    it is used for logging with Insert

    * @param string $Operation The operation being performed. This is usually one of:
    * - Delete: The record has been deleted.
    * - Edit: The record has been edited.
    * - Spam: The record has been marked spam.
    * - Moderate: The record requires moderation.
    * @param string $RecordType The type of record being logged. This usually correspond to the tablename of the record.
    * @param array $Data The record data.
    * - If you are logging just one row then pass the row as an array.
    * - You can pass an additional _New element to tell the logger what the new data is.
    * @return int The log id.

    So it is generally used for logging operations on user content, and specifically posts I you want to do somethign different I suggest, creating your own.

    for debug error logging turn it on in config

      $Configuration['Garden']['Errors']['LogEnabled']  = TRUE;
    $Configuration['Garden']['Errors']['LogFile'] = 'log/error_log';

    make sure you have file permissions set for /log. You can use

    LogMessage(__FILE__,__LINE__,'Object','Method', 'Message');

    grep is your friend.

Answers

Sign In or Register to comment.