Created
June 20, 2014 11:40
-
-
Save wision/7714928124b27db3b055 to your computer and use it in GitHub Desktop.
This file contains 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
WebPage = require 'webpage' | |
msgHandler = (logObject, typex) -> | |
(msg, trace) -> | |
return console.log 'msgx', typex | |
x = typex | |
console.log 'typex', typex | |
msgStack = msg | |
if trace?.length | |
msgStack = [msgStack] | |
msgStack.push 'TRACE:' | |
for t in trace | |
msgStack.push " -> #{t.file || t.sourceURL}:#{t.line} #{t.function}" | |
#logObject[typex] ?= [] | |
true | |
msgHandler2 = (logObject, typex) -> | |
(msg, trace) -> | |
return console.log 'msgx', typex | |
x = typex | |
console.log 'typex', typex | |
msgStack = msg | |
if trace?.length | |
msgStack = [msgStack] | |
msgStack.push 'TRACE:' | |
for t in trace | |
msgStack.push " -> #{t.file || t.sourceURL}:#{t.line} #{t.function}" | |
#logObject[typex] ?= [] | |
true | |
page = WebPage.create() | |
logObject = {} | |
page.onConsoleMessage = msgHandler logObject, "pageMessage" | |
page.onError = msgHandler logObject, "pageError" | |
page.open 'http://www.travelandleisure.com/travel-blog/carry-on/topic/news/the-view-from-shangri-las-new-london-hotel?xid=blog_20140617_26091936' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment