Created
November 10, 2009 15:07
-
-
Save quirkey/230937 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adds a persitant server-side logger to the Sammy logger pool | |
Sammy.addLogger(function() { | |
var message = $.makeArray(arguments).join(', '); | |
// dont provide a callback (aka ignore the results) | |
$.post('/log', "message=" + message); | |
}); | |
Sammy.log('logging', 'should', 'be', 'working'); | |
// POST /log | |
// body: message=[TIMESTAMP], logging, should, be, working |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# super simple sinatra app that logs messages posted to /log to sammy.log | |
require 'sinatra' | |
require 'logger' | |
LOGGER = Logger.new('sammy.log') | |
post '/log' do | |
LOGGER.info params[:message].to_s.split(', ').join("\t") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment