error-formatter
Advanced tools
+20
| The MIT License (MIT) | ||
| Copyright (c) 2013 dead_horse | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| this software and associated documentation files (the "Software"), to deal in | ||
| the Software without restriction, including without limitation the rights to | ||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| the Software, and to permit persons to whom the Software is furnished to do so, | ||
| subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
+10
-2
@@ -73,2 +73,10 @@ /*! | ||
| var safeStringify = function (data, max) { | ||
| var str = util.inspect(data); | ||
| if (str.length > max) { | ||
| str = str.substring(0, max); | ||
| } | ||
| return str; | ||
| }; | ||
| var formatTpl = '%s nodejs.%s: %s' + os.EOL + | ||
@@ -79,3 +87,3 @@ 'pid: %s' + os.EOL + | ||
| 'URL: %s' + os.EOL + | ||
| 'Data: %j' + os.EOL + | ||
| 'Data: %s' + os.EOL + | ||
| '%s'; | ||
@@ -92,5 +100,5 @@ | ||
| infos.url, | ||
| infos.data, | ||
| safeStringify(infos.data, 1024), | ||
| infos.time | ||
| ); | ||
| } |
+2
-2
| { | ||
| "name": "error-formatter", | ||
| "version": "1.0.3", | ||
| "version": "1.0.4", | ||
| "description": "format an error into string / json for log", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
| "dependencies": { | ||
| "utility": "~1.0.0" | ||
| "utility": "^1.0.0" | ||
| }, | ||
@@ -33,0 +33,0 @@ "files": [ |
6619
23.37%4
33.33%84
9.09%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
Updated