Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'logging' of https://github.com/tupton/meed

Conflicts:
	facebook.coffee
  • Loading branch information...
commit f7c50d3e6431ec861eaa18aefb435955d2e98402 2 parents 9f0569e + fe6c943
@mbulman authored
View
5 .gitignore
@@ -1,2 +1,7 @@
*.js
build
+fbauthtoken
+twauthtoken
+twconsumerkey
+node_modules
+
View
8 README.md
@@ -1,13 +1,15 @@
-meed
-----
+# meed
-Coming soon..
+Coming soon.
Requirements:
+
* nodejs
To run:
+
* ./build.sh
* node meed.js
Pardon the mess.
+
View
4 build.sh
@@ -1,4 +1,4 @@
-npm install express facebook-js ntwitter sqlite3
+npm install express facebook-js ntwitter sqlite3 winston
coffee -c *.coffee
@@ -6,4 +6,4 @@ coffee -c *.coffee
npm install -g ender
mkdir build
cd build
-ender build domready reqwest
+ender build domready reqwest winston
View
10 facebook.coffee
@@ -2,6 +2,7 @@ fb = require('facebook-js') #TODO change if/when pull request is accepted
#fb = require('../facebook-js')
fs = require('fs')
util = require('./util')
+winston = require('winston')
TOKEN_FILE = './fbauthtoken'
@@ -9,6 +10,7 @@ class Collector
constructor: (@store) ->
update: (since, limit) ->
+ winston.debug 'Updating Facebook items', { since: since, limit: limit }
token = getToken()
if token
@_getItems token, since, limit, (items) =>
@@ -32,7 +34,7 @@ class Collector
retval = []
for item in items
- #console.log(item)
+ #winston.debug 'Facebook item', item
link = null
switch item.type
when "status", "link"
@@ -53,8 +55,10 @@ class Collector
})
# TODO
#else
- #console.log("Unknown fb item:", item)
- return retval
+ #winston.debug 'Unknown Facebook item', item
+ winston.debug 'Storing '+retval.length+' facebook items'
+ winston.verbose 'Facebook items', retval
+ retval
exports.Collector = Collector
View
6 meed.coffee
@@ -1,4 +1,6 @@
express = require('express')
+winston = require('winston')
+
facebook = require('./facebook')
twitter = require('./twitter')
store = require('./store')
@@ -32,11 +34,11 @@ app.get '/items', (req, res) ->
res.send(items)
app.get '/pos', (req, res) ->
- console.log("Sending stored position:", stored_pos)
+ winston.info 'Sending stored position', stored_pos
res.send(""+stored_pos)
app.put '/pos', (req, res) ->
- console.log("Saving position:", req.body)
+ winston.info 'Saving position', { position: req.body }
stored_pos = req.body
app.listen(3000)
View
4 twitter.coffee
@@ -2,6 +2,7 @@ twitter = require('ntwitter')
fs = require('fs')
util = require('./util')
store = require('./store')
+winston = require('winston')
TOKEN_FILE = './twauthtoken'
CONSUMER_FILE = './twconsumerkey'
@@ -10,6 +11,7 @@ class Collector
constructor: (@store) ->
update: (since, limit) ->
+ winston.debug 'Updating Twitter items', { since: since, limit: limit }
token_file = getFileContents(TOKEN_FILE)
consumer_file = getFileContents(CONSUMER_FILE)
if token_file and consumer_file
@@ -42,6 +44,8 @@ class Collector
source: this._createTwitterStatusLink(item.user.screen_name, item.id_str)
})
+ winston.debug 'Storing ' + items.length + ' Twitter items'
+ winston.verbose 'Twitter items', items
@store.addItems(items)
return
View
6 ui.coffee
@@ -15,13 +15,13 @@ domReady ->
callApi '/items', (items) ->
_drawItems(document.getElementById('posts'), items)
- setTimeout(->
+ setTimeout(->
window.scrollTo(0, 0)
callApi('/pos', (pos) ->
pos = parseInt(pos, 10)
e = document.getElementById(pos)
if pos and e and e.offsetTop
- console.log(pos, e, e.offsetTop)
+ console.log pos, e, e.offsetTop
window.scrollTo(0, e.offsetTop)
timer = null
@@ -67,6 +67,6 @@ _saveScroll = ->
elem = elem.parentNode
if elem.id
- console.log(elem.id)
+ console.log elem.id
callApi('/pos', (->), elem.id)
return
Please sign in to comment.
Something went wrong with that request. Please try again.