bows icon indicating copy to clipboard operation
bows copied to clipboard

[Suggestion] Debug = false

Open sospedra opened this issue 9 years ago • 5 comments

I'm using this awesome logger and then I realised that I cannot disable the logger setting the flag localStorage.debug to false. After the first time you set up this flag to true it'll remain until you clear your localStorage so, I think, that would be nice that the false value just run a simple localStorage.removeItem('debug').

Just saying, nice job by the way.

sospedra avatar Apr 29 '15 07:04 sospedra

I'm not sure what you mean? Do you mean if bows detects that you ran localStorage.debug = false instead of removeItem, then it'll delete the "false" for you?

latentflip avatar Apr 29 '15 07:04 latentflip

I try to make it simplier ;)

As I tested if you put localStorage.debug = false it won't disable the logs. In the fact of, they still appearing. Because localStorage persist through the time.

So, I think that bows should run localStorage.removeItem('debug'). And the easiest way is by managing the debug flag as an option of bows; just like padLength. This functionality will allow us to work with the environments easier. For example, being able to define npm scripts for production and development.

Or, maybe, bows is bugged and it doesn't work as expected.

sospedra avatar Apr 29 '15 09:04 sospedra

After some investigation I notice that the flag manager is provided by andlog and they suggest delete the localStorage key instead of setting it to false. Maybe bows shouldn't manage this keeping in mind that the goal of this module is to provide the colours functionality to the front-end console.

So, this is now something up to you ;)

sospedra avatar Apr 30 '15 14:04 sospedra

Setting localStorage.debug to false to disable logging won't work as, at least here in Chrome 47, it gets converted to "false" (the string). Not sure if you had that in mind @latentflip! Cheers

ruiramos avatar Jan 18 '16 12:01 ruiramos

Have fixed the readme at least: https://github.com/latentflip/bows/commit/4c9a832096989a819aea9b8feff2a6c8a8ec095f but yeah, could probably rethink debug = "false" at some point. Would probably mean dropping andlog and just doing that stuff ourselves.

latentflip avatar Jan 18 '16 12:01 latentflip