Postman format console log output - javascript

I'm using the open source version of Postman
I have a console log output in the Pre-Request script for each of my API calls, which just outputs the title of the call.
Is there a way of formatting the console log output in postman to make it stand out in the console log? I want to either enlarge or bold the text or make it a different colour so it is clear in the console log.

It doesn't seem to be possible, though console output gets some different colors for error codes or strings.
javascript string formatting doesn't work either. You should output some visible strings like you would do in normal consoles like:
console.log("******************************");
console.log("********* MY TEST ********");
console.log("******************************");
sorry, can't see a better way
Alexandre

In node.js there is by using escape sequence:
console.log('\x1b[36m%s\x1b[34m%s\x1b[0m', 'I am cyan','i am blue');
So you should be able to if running Newman as a library within Node. And there is a way to provide colors for browser based console.log; however, not in the desktop application. I too would much appreciate some simple formatting to help my log events to stand out from the rest. But I have resorted to using something similar to a-joly's response above
console.log("******************************");
console.log("********* MY TEST ********");
console.log("******************************");
to help with this issue.
There are other formatting styles capable within Node's console.log as well, they can be viewed here:

Related

In chrome console how to copy the last 20 commands i have written to clipboard

Is there a way to copy all the commands i have written, or to give it some range. Or at least print them out together so i can copy them.
I was trying out jquery selectors in console, after half hour of dealing with very messy dom structure i finally got what i wanted now to transfer that i have to back in history and copy paste every single command. It'd be nice if could log all i have writen, or like last 30 commands etc.
I think it should be possible, as i have seen pretty other advanced abilities of chrome console.
This answer appears to address your question.
Enable logging from the command line using the flags:
--enable-logging --v=1
This logs everything Chrome does internally, but it also logs all the
console.log() messages as well. The log file is called
chrome_debug.log and is located in the User Data Directory.
Filter the log file you get for lines with 'CONSOLE(\d+)'.
via Save the console.log in Chrome to a file
More here on logging. The Chromium Projects: How to enable logging

How to avoid to Chrome console to print JSON objects in short forms in javascript?

I try to print image as byte array bsae 64 by using JSON.stringify(...)
but it prints only short version of it.
Instead:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABKCAYAAAAc0MJxAAAABHNCSVQICAgIfAhkiAAABHNJREFU\neJztmk1rJEUAhp+q7p6ezEycbIZsTA5uxMSD4B7US0BE8KAXxVMuwurVk/4Kf4D+AEHworiK6E1B\n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OblI1ZW\n1/eAyTiyodb0lGbCkUx6kpIj8aXAFQLF4W9tFdEKIw7CiIIUeCnutWTh4wJBXDFXCFxXoIG9vqLZ\nVxyfWYU4HAeEEJTd9D9GZ+HjAp2kggIe7BZm9/nuTNL0GTrrWQ6RQDVviYuABB7+xdByAomt/hhh\nQzLEBmWIDcoQG5QhNihDbFCG2KAMsa1gQ2wr2BDbCjbEtoINsa1gQ2wr2BDbCjbEtoKNr5HkJNsK\nNse2gg2xrWADbCvYQMi2godgW8G2FWxbweP0sa1gQx/bCjb0sa1gQx/bCjbEtoINGRqUbQUfMnAr\n2LaCHzB0wWlbwYZBPYxHtRUcm0e1FZyYR60VbDFAAq28JS4CEvTveUtcBCTIz/KWuAj8Cy9vAbfs\nZ+QcAAAAAElFTkSuQmCC\n
I get:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABKCAYAAAAc0MJxAAAABHNCS…e1FZyYR60VbDFAAq28JS4CEvTveUtcBCTIz/KWuAj8Cy9vAbfs\nZ+QcAAAAAElFTkSuQmCC\n
^^^
I tried:
JSON.stringify(visible_groups);
JSON.stringify(visible_groups, undefined, 2);
How to get rid of it?
[EDIT]
I know that its proper print and URL contains full text, but I try to copy to clipboard full version
Thanks,
That's just an artefact of how you're looking at it in the Chrome console, it's not in the real string. JSON.stringify doesn't arbitrarily elide your data.
Answering your updated question:
I know that its proper print and URL contains full text, but I try to copy to keyboard full version
console.log(visible_groups[0].mAvatarImgBase64Str); (or something like that, obviously I can't see much in that screenshot, no idea which index you want) should dump it to the console in a way you can copy it. If this is coming across the network, you can probably also get it from the Network tab.

JS: Output the content of the console log

I'm using the console log to record any errors in a HTML/JS web application. Is there a way to output the contents of the console log?
For instance, lets say we log "Hello world" console.log('Hello world');
Is there a way I can get back what's been logged at a later time? Something like:
alert(console.log());
Thanks in advance!
The console provides a log method which does nothing other than write your message into the console output in real time. You can see this in the developer tools of many browsers.
There is no way to ask the native console for a list of things logged. You would need to write something yourself, perhaps augmenting the native console.
No, that is not possible.
Check this link for the full Console API Reference for Google Chrome. Other browsers have their own console API, but they're generally the same.

How to filter messages in Firefox Error Console?

Some of the web pages that I need to be open, while developing my script, produce a lot of errors that go into the Error Console of the Firefox. This makes it really hard to spot the errors, which are produced by the script, that I am trying to develop. Is there any way to filter the errors in Error Console? For example display only those that begin with my custom tag.
Sounds like you need a console prividing some filter and search capabilities like Console². It replaces the standard console with a more powerful version and works quite well. And it has a search box.
Yes, nowadays you can filter in the console, using built-in functionality. You can select different type of console messages, or even filter by a custom string, such as your own tag.
Have checked console.group method? This should be excatly what you are looking for
http://getfirebug.com/wiki/index.php/Console_API#console.log.28object.5B.2C_object.2C_....5D.29
https://developer.mozilla.org/en-US/docs/Web/API/Console/group

Getting data from the browser's console using javascript

I don't know if this has been asked before, but what i'd like to be able to do is get data from the error console within the browser itself(if it supports it) this would be for when a user sends off a bug report it'd pull up any errors related to pages at my website for things such as typos in code and other things that somehow managed to slip by. Also, in that regard is there a way to pass the errors from the console to a useable format? If this isn't possible, then i could just tell them to copy and paste what came up from the site itself.
I thought of this right now as i was thinking about how to make the bug reporting system run better since the entire thing is basically ran within the browser and for the backend I can easily just look at error logs but for the frontend ie javascript bits of things it's not goign to be as easy.
So to finish wrap all of this up in one little statement, is there an easy way to get the data from the error console and be able to send it along via javascript ie to a form, or something similar.
You can use the onerror event in JS to get the details of the error. Hoptoad do this for example and log the errors to their console, Their code re-uses lots of nice JS scripts including a printStackTrace function that is great.....
You can see how they do it here:
http://hoptoadapp.com/javascripts/notifier.js

Categories