All Projects → r-lib → Debugme

r-lib / Debugme

Licence: other
Easy and efficient debugging for R packages

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Debugme

Ios Sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 56 (-52.54%)
Mutual labels:  debugging-tool
Semile
Profile what you care, monitor how it goes (support C/C++)
Stars: ✭ 89 (-24.58%)
Mutual labels:  debugging-tool
Glasgow
Scots Army Knife for electronics
Stars: ✭ 1,374 (+1064.41%)
Mutual labels:  debugging-tool
Autotrace
Runs a process, and gives you the output along with other telemetry on the process, all in one terminal window.
Stars: ✭ 68 (-42.37%)
Mutual labels:  debugging-tool
Rex Diagnostics
Unity extension that enables expression evaluation at runtime to facilitate testing and debugging.
Stars: ✭ 78 (-33.9%)
Mutual labels:  debugging-tool
Daggy
Daggy - Data Aggregation Utility. Open source, free, cross-platform, server-less, useful utility for remote or local data aggregation and streaming
Stars: ✭ 91 (-22.88%)
Mutual labels:  debugging-tool
Power trace
Buff exception backtrace with local variables, passed in arguments and instance variables!
Stars: ✭ 48 (-59.32%)
Mutual labels:  debugging-tool
16counters
GUI for those who don't do GUI
Stars: ✭ 114 (-3.39%)
Mutual labels:  debugging-tool
Python Varname
Dark magics about variable names in python
Stars: ✭ 89 (-24.58%)
Mutual labels:  debugging-tool
Pandora
an android library for debugging what we care about directly in app.
Stars: ✭ 1,365 (+1056.78%)
Mutual labels:  debugging-tool
Bugsnag Python
Official bugsnag error monitoring and error reporting for django, flask, tornado and other python apps.
Stars: ✭ 69 (-41.53%)
Mutual labels:  debugging-tool
Strongod
StrongOD(anti anti-debug plugin) driver source code.
Stars: ✭ 76 (-35.59%)
Mutual labels:  debugging-tool
The Debuginator
A juicy feature-packed debug menu intended for games.
Stars: ✭ 91 (-22.88%)
Mutual labels:  debugging-tool
Robin
Robin is a logging library for Bundle data passed between Activities and fragments. It also provides a callback to send screen views of user visited pages to your analytics client
Stars: ✭ 63 (-46.61%)
Mutual labels:  debugging-tool
Capturecalls.js
captureCalls('document.getElementById') to show a stack trace for document.getElementById on its every call
Stars: ✭ 112 (-5.08%)
Mutual labels:  debugging-tool
Bugsnag Node
[DEPRECATED] Please upgrade to our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
Stars: ✭ 48 (-59.32%)
Mutual labels:  debugging-tool
James
Web Debugging Proxy Application
Stars: ✭ 1,299 (+1000.85%)
Mutual labels:  debugging-tool
Frodo
Android Library for Logging RxJava Observables and Subscribers.
Stars: ✭ 1,496 (+1167.8%)
Mutual labels:  debugging-tool
Lambda Toolkit
*DO NOT USE* - This project was done during my initial python and lambda's studies. I would recommend you the `serverless framework`.
Stars: ✭ 114 (-3.39%)
Mutual labels:  debugging-tool
Chrome Protocol Proxy
Chrome DevTools Protocol Proxy - intelligent proxy for debugging purposes
Stars: ✭ 94 (-20.34%)
Mutual labels:  debugging-tool

debugme

Debug R Packages

Linux Build Status Windows Build status CRAN RStudio mirror downloads Coverage Status

Specify debug messages as special string constants, and control debugging of packages via environment variables. This package was largely influenced by the debug npm package.

Installation and Usage

install.packages("debugme")

To use debugme in your package, import it, and then add the following .onLoad function to your package:

.onLoad <- function(libname, pkgname) {
  debugme::debugme()
}

You can now add debug messages via character literals. No function calls are necessary. For example:

"!DEBUG Start up phantomjs"
private$start_phantomjs(phantom_debug_level)

"!DEBUG Start up shiny"
private$start_shiny(path)

"!DEBUG create new phantomjs session"
private$web <- session$new(port = private$phantom_port)

"!DEBUG navigate to Shiny app"
private$web$go(private$get_shiny_url())

The string literals are simply ignored when debugging is turned off. To turn on debugging for a package, set the environment variable DEBUGME to the package name you want to debug. E.g. from a bash shell:

export DEBUGME=mypackage

Or from within R:

Sys.setenv(DEBUGME = "mypackage")

Separate multiple package names with commas:

export DEBUGME=mypackage,otherpackage

The debug messages will be prefixed by the package names, and assuming your terminal supports color, will be colored differently for each package.

Example

Dynamic code

The debugme debug strings may contain R code between backticks. This code is evaluated at runtime, if debugging is turned on. A single debug string may contain multiple backticked code chunks:

"!DEBUG x = `x`, y = `y`"
if (x != y) {
...

Motivation

I have always wanted a debugging tool that

  • is very simple to use,
  • can be controlled via environment variables, without changing anything it the packages themselves,
  • has zero impact on performance when debugging is off.

debugme is such a tool.

Performance

Function calls are relatively cheap in R, but they still do have an impact. If you never want to worry about the log messages making your code slower, you will like debugme. debugme debug strings have practically no performance penalty when debugging is off.

Here is a simple comparison to evaluate debugging overhead with a function call, f1(), debugging with debug strings, f2(), and no debugging at all.

debug <- function(msg) { }
f1 <- function() {
  for (i in 1:100) {
    debug("foobar")
    # Avoid optimizing away the loop
    i <- i + 1
  }
}
f2 <- function() {
  for (i in 1:100) {
    "!DEBUG foobar"
    # Avoid optimizing away the loop
    i <- i + 1
  }
}
f3 <- function() {
  for (i in 1:100) {
    # Avoid optimizing away the loop
    i <- i + 1
  }
}
microbenchmark::microbenchmark(f1(), f2(), f3())
#> Unit: microseconds
#>  expr    min      lq      mean median      uq       max neval cld
#>  f1() 19.585 20.8030 189.88149 21.718 23.5735 16721.969   100   a
#>  f2()  4.988  5.8665  26.00780  7.314  9.5685  1777.398   100   a
#>  f3()  4.513  5.4030  25.57436  6.354  8.3195  1793.295   100   a

License

MIT © Gábor Csárdi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].