Giter VIP home page Giter VIP logo

papertrail-drupal's Introduction

Papertrail for Drupal

Copyright 2012 Adam Kalsey http:/kalsey.com/

Integrates with Papertrailapp.com to implement a live "tail -f" style interface for logging that is managed with Papertrail. Future releases will provide more facilities for searching Papertrail logs and configuring and managing your Papertrail account.

Originally developed for Tropo's voice and SMS API service.

Requirements

Installation

After enabling the module, go to admin/config/development/logging/papertrail and enter your API key.

Usage

First, start sending logs to Papertrail. This doesn't do anything unless Papertrail is indexing your logs. Visit admin/reports/papertrail for the default tail view. You'll see recent log items appear right away, and as new log items are indexed, they'll appear in the log viewer.

To implement a tail in your own Drupal module, you'll want to create two functions, both with hook_menu entries. One function will be your ajax source and will call papertrail_tail_data with your search string. The other is the URL your users will connect to in order to view the tail and will make a recursive ajax call to retreive and display the search results.

function yourmodule_debugger_source() {
  print papertrail_tail_data(array('parameter' => 'search-string'));
}

function yourmodule_debugger() {
  // reset the min_id tracker.
  papertrail_tail_data(array('#reset' => true)); 
   
  // the URL of the ajax backend (the menu pointing at 
  // yourmodule_debugger_source() in this example)
  drupal_add_js('var url = "' . url('url/to/yourmodule_debugger_source', array('absolute' => TRUE)) . '";', 'inline');
  // include the papertrail ajax JS
  drupal_add_js(drupal_get_path('module', 'papertrail') . '/tail.js', array('scope' => 'footer'));
  
  // tail.js will append new log lines to #papertrail-wrapper
  return '<div id="papertrail-wrapper">Ready.</div>';
}

papertrail-drupal's People

Contributors

akalsey avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.