Permalink
Browse files

v2.0.3. Bugfix.

- v2.0.3 May 19, 2013
	- iOS support (iOS devices do not have `new Error().stack`)
  • Loading branch information...
1 parent ab7165b commit d23682835d9021e699b5675ca5291b383dc2c4a7 @balupton balupton committed May 19, 2013
Showing with 9 additions and 3 deletions.
  1. +3 −0 History.md
  2. +1 −1 package.json
  3. +5 −2 src/lib/caterpillar.coffee
View
@@ -1,5 +1,8 @@
## History
+- v2.0.3 May 19, 2013
+ - iOS support (iOS devices do not have `new Error().stack`)
+
- v2.0.2 May 7, 2013
- Fixed defaulting the log level
- Closes [issue #6](https://github.com/bevry/caterpillar/issues/6) reported by [Erik Dasque](https://github.com/edasque)
View
@@ -1,6 +1,6 @@
{
"name": "caterpillar",
- "version": "2.0.2",
+ "version": "2.0.3",
"description": "Caterpillar is the ultimate logging system for Node.js, based on transform streams you can log to it and pipe the output off to different locations, including some pre-made ones. Caterpillar also supports log levels according to the RFC standard, as well as line, method, and file fetching for messages. You can even use it in web browsers with caterpillar-browser.",
"homepage": "https://github.com/bevry/caterpillar",
"keywords": [
@@ -104,7 +104,7 @@ class Logger extends Transform
# Retrieve
err = new Error()
- lines = err.stack.split('\n')
+ lines = err.stack?.split('\n') or [] # ios devices do not have err.stack available
for line in lines
continue if line.indexOf(__dirname) isnt -1 or line.indexOf(' at ') is -1
parts = line.split(':')
@@ -143,9 +143,12 @@ class Logger extends Transform
log: (args...) ->
# Prepare
entry = @format(args...)
- entryString = JSON.stringify(entry)
+
+ # Emit the entry
+ @emit('log', entry)
# Write the entry
+ entryString = JSON.stringify(entry)
@write(entryString)
# Chain

0 comments on commit d236828

Please sign in to comment.