Permalink
Browse files

logging

  • Loading branch information...
tj committed Dec 18, 2011
1 parent 2f2928c commit af16808eb6f22b4e65818bb3097d3580321172e1
Showing with 10 additions and 2 deletions.
  1. +1 −0 events.js
  2. +7 −2 palette.js
  3. +2 −0 routes.js
View
@@ -8,6 +8,7 @@ var db = app.db;
app.on('screenshot', function(url, path, id){
var now = Date.now();
+ console.log('screenshot - saving meta-data');
db.zadd('screenshot:ids', now, id);
db.zadd('screenshot:urls', now, url);
db.zadd('screenshot:hosts', now, parse(url).host);
View
@@ -14,8 +14,13 @@ app.on('screenshot', function(url, path, id){
console.log('palette - reading %s', path);
colors(path, function(err, colors){
if (err) return console.error(err.stack);
-
- })
+ console.log('palette - colors computed');
+
+ colors.forEach(function(color){
+ db.sadd('screenshot:color:' + color, id);
+ db.sadd('screenshot:' + id + ':colors', color);
+ });
+ });
});
/**
View
@@ -37,8 +37,10 @@ app.get('/:url(*)', ratelimit(60, 10), function(req, res, next){
if (!url) return res.send(400);
var id = utils.md5(url);
var path = join(dir, id + '.png');
+ console.log('screenshot - rasterizing %s', url);
rasterize(url, path, function(err){
if (err) return next(err);
+ console.log('screenshot - rasterized %s', url);
app.emit('screenshot', url, path, id);
res.sendfile(path);
});

0 comments on commit af16808

Please sign in to comment.