Raise Warning in Hook? - apiary.io

Is it possible to raise a Warning message within a hook function? I can log a message with hook.log() but would like it to be properly handled as loglevel 'warning'.
hooks.log("WARNING: Something unusual has happened")

I'm the Dredd maintainer. You didn't mention whether you use the standard Node.js hooks or the now deprecated and removed sandboxed JavaScript hooks.
In Node.js hooks there's no way you can hack into Dredd's own logging output, but you could implement it on your own. Dredd's logging uses winston, so you could set it up the same way as in Dredd in your hooks and then log a warning, which is going to look like Dredd's warning.
However, my honest advice would be forget about warnings. Make strict rules and let the testing fail. People overlook warnings in the output, or don't read them at all when the project is tested on CI.

Related

How to disable warnings in NetBeans output window?

Is it possible to disable WARNINGS (text in red) for the Output window, and only allow it to report errors?
I try a bit with the settings, and according to other posts I set Quiet for the Ant, and option -q for Maven, but it has no effect whatsoever.
So can anyone tell if it can be done at all, and if so, how, please?
From what I see the warnings are generated by the program you execute (or maybe by a library used by your program).
Ant or Maven are build tools to generate your program, that's why changing their verbosity level won't impact the program output.
You should check if your program accepts some command-line options, there might be one to adjust the verbosity level.
EDIT: just had a look at "aparapi", I see that it's a library, so you should check the library API if you can configure the verbosity level, or if you can redirect log messages to a file.

How to make VSCode's python debugger skip stepping into some modules when debugging

In vscode's python (ms-python) extension, is there a way to make the debugger (debugpy) not to step-into functions defined in specific modules. I have found justMyCode but it will skip entering into external modules only (like members of stdlib) while I need to skip my own modules sometimes.
I saw some debug adaptors for some other languages implement skipFiles property. Is there anything similar for python?
Going thru debugpy code I found this undocumented feature which works like a charm: in launch.json's debug configuration add
"rules" : [{"module":"*xxx*", "include":false}]. Make sure the xxx is the full module name like a.b.module
There are more working options. They can be seen here
A word of warning. This feature is undocumented (at least I did not find it anywhere) so use with caution as it might disappear one day. At the other hand, this feature is properly tested as part of the code uni-testing (as you can see from the link)

How to capture stack trace for Ncurses app?

Typically, when running an application from the command line, I get a nicely printed trace when things go wrong. But, since I happen to be working on an Ncurses application, the trace gets mixed in with the interface that was running, and the output gets all jumbled. Like so:
Specifically, I'm working on this project: todo-curses.
I'm running the app as a Rake task, so I figured the --trace option would help me, but I just can't seem to figure it out. Is there a good way to log the output of the app to a file or something and not include the Ncurses interface with it?
It depends on the application: curses writes to the standard output by default. If you (as the developer of the curses application) use newterm for initializing the library rather than initscr, then you can tell it to write the screen interface to the standard error.
But developers of bindings for curses from other languages typically leave out newterm as an alternative, just to make things simple. For instance, the Ruby curses shown on github has this deficiency. Perhaps a bug report is due.

Debugging a Thunderbird extension

I'm working on a Thunderbird extension, and, unfortunately, can't sort out what's still valid from what's not. There's lots of stuff online, but, most of it is no longer applicable to recent Thunderbird.
At a minimum, I need a way of seeing log messages from the extension, so I can see what's working and what's not. Ideally, I'd like a full debug console. There is a reference on Stackoverflow to Thunderbird Developer Tools, but there doesn't seem to be a way to download them.
I'd also like to be able to execute Javascript that can reference my extension via the console. When I try this via Thunderbird's console, I get error messages. I get this even when using other people's extensions, so I have to assume that extensions are outside the scope of the console
How can I get visibility and interaction to a new Thunderbird extension?
2020 Update:
If you are writing a MailExtension (this is how WebExtension are called for Thunderbird) you should have a look at general debugging in WebExtensions, e.g. https://extensionworkshop.com/documentation/develop/debugging/
You should probably also take a look at the general developer documentation on MailExtension at https://developer.thunderbird.net/add-ons/about-add-ons
The thinks listed below there written for the Legacy Overlay Extension, which do not work in newer Thunderbird versions.
logging messages
As described in https://developer.mozilla.org/en-US/docs/Debugging_JavaScript, there exist 3 different consoles in Gecko. The one best accessible in Thunderbird is the Error Console. You can write messages to it through the nsIConsoleService. If you don't mind that the log messages show up as an error, you can also simply use Components.utils.reportError().
Another way is to log to the (native) console from which Thunderbird is started. This is done through dump().
The newest way to log messages is using the Log.jsm module. It is a very nice wrapper around the different logging methods, and my preferred way to log messages in Thunderbird.
Thunderbird Developer Tools
As you haven't linked to the reference, I'm not 100% sure, but I think you mean the possibility to remotely debug Thunderbird through Firefox. You don't need to download anything to use this, it is already integrated in Thunderbird.
execute Javascript that can reference my extension
Debugging Thunderbird remotely through Firefox gives also access to the console and Scratchpad in the Developer Tools. Both should have also access to the add-on.
You may also want to look at the Tiny JavaScript Debugger. It also allows the execution of arbitrary code while debugging.

pydbg thread refuses to print log information

I am running the Sulley fuzzing tool, which uses pydbg to debug the target process. The pydbg threads are spawned in the process_monitor.py module of the Sulley environment. My problem is that when a test case (malformed packet) causes the process to crash, the debugger thread continues to run, and the following test case triggers an access violation.,This is then sent to the session module saying the wrong packet, the second test case caused the access violation.
I am trying to print the log information from pydbg to debug exactly what is happeneing, but nothing I do seems to be working. Obviously since this a thread it has no console to print to, so I've tried many different methods of writing to a file.
Even a very straight forward
logFile = open('C:\sulley_build\sulley\logFile.txt', 'w')
logFile.write("test")
won't create a file at that location. I know the pydbg thread is spawned, yet even putting that code in the _init__ function does nothing.
Help?
It's been a while since I've worked with the process monitor, but here's my advice:
Sulley had several procmon bugs when I used it. I submitted two patches here:
https://github.com/OpenRCE/sulley/pull/94
https://github.com/OpenRCE/sulley/pull/83
These bug fixes may be related to your issue (hard to tell with Sulley's architecture). I would give them a try. The fixes are already applied on my fork, or you can manually apply them in your own fork.
It sounds like the procmon is not reporting the crash properly. I distinctly remember this issue, but can't recall if the fixes mentioned above resolve it. If you do try to get it working, the key method is ProcessMonitorPedrpcServer.post_send.
If you want to report more crash details, try writing them into self.last_synopsis. See ProcessMonitorPedrpcServer.get_crash_synopsis.
Happy fuzzing!