41 Commits

Author SHA1 Message Date
Nathan Rajlich
8e09edf8f6 browser: whitespace 2016-11-14 16:31:44 -08:00
Andrew E. Rhyne
3491ad6e3a Merge pull request #195 from jalleyne/master
Catch JSON stringily errors.
2016-11-14 09:34:32 -08:00
Levi Thomason
20c37fdc16 fix(browser): do not override ls debug if found 2016-11-13 10:26:59 -08:00
Nathan Rajlich
a746d52cf2 don't create an empty object when no process
This is also more readable in my opinion.
2016-11-10 09:59:27 -08:00
Tom Newby
0b6ca275e6 fix(browser): should check whether process exists
Closes #325.
2016-11-09 22:26:13 -08:00
Paul Betts
dc86779d52 If we're in Electron, try to fallback to process.env.DEBUG if we've got it 2016-11-09 15:01:46 -08:00
Valeri Karpov
d39abeda93 fix(browser): remove variable thats undefined in react-native
https://github.com/facebook/react-native/pull/1632
2016-05-26 07:38:16 -07:00
Jovan Alleyne
6830d9fbee Catch JSON stringily errors.
There is a chance that there may be circular references in the Object which will cause the debug message to throw an exception. If the exception is not handled on the application level this will cause node to crash. As a debug library, errors in here should not have such a serious impact on the application.
2015-04-08 15:25:48 -04:00
Stephen Mathieson
a6e8154318 browser: expose storage
This patch allows overriding the default `storage` mechanism.

Closes #188.
2015-03-26 12:36:51 -04:00
Amir Abushareb
988592b640 fix: security error on safari - closes #167 2015-01-07 11:16:55 +02:00
Nathan Rajlich
df3e0eabdb browser: use typeof to check for console existence
It's a global, so we must check with typeof otherwise
an error will be thrown if `console` is undefined.
2014-12-29 13:43:38 -08:00
Nathan Rajlich
a98c283095 Merge pull request #143 from marmolejo/master
add support for chrome apps
2014-12-29 13:20:39 -08:00
Moo Yeol, Lee (Prescott)
6af0b4d764 browser: check for console.log truthiness instead
Related to PR #166
2014-12-30 04:19:49 +09:00
Moo Yeol, Lee (Prescott)
4dce97e6db browser: Fixed that no logs output on IE8/9
IE 8/9 reports console methods as objects when using the typeof operator.
https://web.archive.org/web/20111123190115/http://whattheheadsaid.com/2011/04/internet-explorer-9s-problematic-console-object

Closes #148.
2014-12-30 02:25:34 +09:00
Zeus Gómez Marmolejo
3f97ec6f00 better checking for undefined value 2014-10-17 12:08:54 +02:00
Zeus Gómez Marmolejo
de8695b6be corrected PR for other browsers
Sorry, this should work now. window.localStorage is undefined in chrome apps.
2014-10-08 17:27:33 +02:00
Zeus Gómez Marmolejo
e9c730a6e2 add support for chrome apps 2014-09-30 18:34:48 +02:00
Nathan Rajlich
6f278e3b4c browser: place %c marker after the space character
This way, in Firefox 31, the "main content" of the debug
call will not have any extra whitespace on the left of it.
2014-07-15 15:55:52 -07:00
Nathan Rajlich
998d85bac9 browser: reset the "content" color via color: inherit
Necessary for Firefox v31, which seems to retain the previous
color from a previous %c color formatter when an empty string
is given.
2014-07-15 15:41:03 -07:00
Nathan Rajlich
165e937e6d browser: add colors support for Firefox >= v31
Part of #116.
2014-07-15 15:40:16 -07:00
Nathan Rajlich
2f70264aad browser: fix lint 2014-06-16 17:24:54 -07:00
G Scott Olson
d738362777 Restore color order. 2014-06-10 17:17:41 -04:00
G Scott Olson
5f54356b6d Update color palette. 2014-06-10 16:57:20 -04:00
Tim Oxley
dd32a4c902 Make console logging function configurable.
Split log() into 2 methods: formatArgs() and log(), allowing log to be
overridden on a per-namespace or global level. Global log settings trump
per-namespace settings.
2014-06-07 23:34:39 -07:00
Nathan Rajlich
c1b0c6e9cc browser: use removeItem() to clear localStorage 2014-06-06 13:08:59 -07:00
David M. Lee
3aa365ae93 Don't set DEBUG if namespaces is undefined.
On Node.js, if you set a process.env field to either null or undefined,
it gets cast to string 'null' or 'undefined'.

For debug, this means that if you don't have DEBUG set, it will get set
to the string 'undefined'. There are other modules (like
node-rest-client) which use the DEBUG environment variable that will
start spewing debug output when you don't want it to.
2014-06-06 15:01:50 -05:00
Nathan Rajlich
872115d10a make ms diff be global, not be scope
Closes #88.
Closes #90.
2014-06-02 11:36:49 -07:00
Nathan Rajlich
e502a7df95 *: export the colors array
DRYs up some of the logic in the process,
since the "core" color handling code gets
moved to `debug.js`

Closes #20.
2014-06-01 10:32:30 -07:00
Nathan Rajlich
9b5e9f7ef2 browser: even more robust "%c" handling
Now we support the user passing in their own
"%c" fields in `debug()` calls.
2014-06-01 10:26:58 -07:00
Nathan Rajlich
32b0bf41eb browser, node: rename c to color
More clear for the user to override it this way.
See: #95
2014-05-31 19:18:41 -07:00
Nathan Rajlich
84951941a8 browser: map "%j" to JSON.stringify() 2014-05-31 14:24:43 -07:00
Nathan Rajlich
0f61fca93f browser: don't let "%%" throw off the color insertion index 2014-05-31 14:17:21 -07:00
Nathan Rajlich
a4aacbd785 browser: fix the case of passing additional arguments after the "format"
Before the "%c" CSS color value was potentially being
inserted into the wrong place in the arguments array,
which would throw the formatting off in the Console.
2014-05-31 12:55:05 -07:00
Nathan Rajlich
eb80377e34 browser: fix colors in strict mode 2014-05-31 12:25:14 -07:00
Nathan Rajlich
8bed009c84 browser: add Firebug color support 2014-05-31 11:16:12 -07:00
Nathan Rajlich
79b75ad626 browser: add colors for WebKit browsers
Based off of the implemention from #67, except this one
matches the Node.js colored output exactly, including the
trailing `diff` value.
2014-05-30 22:48:44 -07:00
Nathan Rajlich
3314c7761c browser: don't default save() to empty string 2014-05-30 22:13:23 -07:00
Nathan Rajlich
bea76f587b browser: fix undefined name variable 2014-05-30 00:29:14 -07:00
Nathan Rajlich
3eebad470a browser: fix comment typo 2014-05-30 00:23:56 -07:00
Nathan Rajlich
d05b468ee2 browser: , -> . 2014-05-30 00:18:08 -07:00
Nathan Rajlich
2cffe24185 rewrite: abstract common logic for Node & browsers 2014-05-30 00:10:10 -07:00