All Projects → tuwukee → Blab

tuwukee / Blab

Licence: mit
A debugging tool

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Blab

Unitydbgdraw
DbgDraw is an API that provides the ability to render various 2D and 3D shapes for visual debugging purposes.
Stars: ✭ 20 (-71.01%)
Mutual labels:  debug
Logdown.js
✏️ Debug utility with markdown support that runs on browser and server
Stars: ✭ 1,013 (+1368.12%)
Mutual labels:  debug
Tracer
A powerful and customizable logging library for node.js
Stars: ✭ 1,081 (+1466.67%)
Mutual labels:  debug
Java Debug Tool
Java dynamic debug tool
Stars: ✭ 26 (-62.32%)
Mutual labels:  debug
Bugsnag Android
Bugsnag crash monitoring and reporting tool for Android apps
Stars: ✭ 990 (+1334.78%)
Mutual labels:  debug
Debuguisystem
Create a runtime menu system with buttons and windows for debugging in one line of code.
Stars: ✭ 48 (-30.43%)
Mutual labels:  debug
Dap Mode
Emacs ❤️ Debug Adapter Protocol
Stars: ✭ 809 (+1072.46%)
Mutual labels:  debug
Breachdetector
Detect root, emulation, debug mode and other security concerns in your Xamarin apps
Stars: ✭ 57 (-17.39%)
Mutual labels:  debug
Fliplog
fluent logging with verbose insight, colors, tables, emoji, filtering, spinners, progress bars, timestamps, capturing, stack traces, tracking, presets, & more...
Stars: ✭ 41 (-40.58%)
Mutual labels:  debug
San Devtools
Browser developer tools extension for debugging San.
Stars: ✭ 51 (-26.09%)
Mutual labels:  debug
Appmetrics
Node Application Metrics provides a foundational infrastructure for collecting resource and performance monitoring data for Node.js-based applications.
Stars: ✭ 864 (+1152.17%)
Mutual labels:  debug
Hugo Debugprint
Hugo "debugprint.html" partial
Stars: ✭ 35 (-49.28%)
Mutual labels:  debug
Bugsnag Node
[DEPRECATED] Please upgrade to our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
Stars: ✭ 48 (-30.43%)
Mutual labels:  debug
React Native Deploy Checklist
Compilado de problemas do React Native em relação ao deploy e suas soluções
Stars: ✭ 26 (-62.32%)
Mutual labels:  debug
Ios Sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 56 (-18.84%)
Mutual labels:  debug
Echo
Echo是一款桌面端调试工具,旨在提高客户端的研发调试效率
Stars: ✭ 818 (+1085.51%)
Mutual labels:  debug
Android Debug Database
A library for debugging android databases and shared preferences - Make Debugging Great Again
Stars: ✭ 7,946 (+11415.94%)
Mutual labels:  debug
Memstrack
A memory allocation tracer combined with stack trace.
Stars: ✭ 60 (-13.04%)
Mutual labels:  debug
Gdbstub
A simple, dependency-free GDB stub that can be easily dropped in to your project.
Stars: ✭ 56 (-18.84%)
Mutual labels:  debug
Panic Overlay
Displays JS errors in browsers. Shows sources. Use with any framework. 💥✨
Stars: ✭ 50 (-27.54%)
Mutual labels:  debug

blab

Gem Version

A debugging tool.

The gem allows to trace local variables and memory usage for Ruby code.
It's intended for use in a development environment only.
Blab is inspired by PySnooper.

Installation

Put this line in your Gemfile

gem "blab", group: :development

Then run

bundle install

Usage

Use the blab decorator in front of a method defenition.

require "blab"

class Test
  blab def longest_rep(str)
    max = str.chars.chunk(&:itself).map(&:last).max_by(&:size)
    max ? [max[0], max.size] : ["", 0]
  end
end

Test.new.longest_rep("cbaaabb")

The output to STDOUT:

Var......... str="cbaaabb"
18:17:26.042 call   test/support/test.rb:46        blab def longest_rep(str)
18:17:26.042 line   test/support/test.rb:47          max = str.chars.chunk(&:itself).map(&:last).max_by(&:size)
Var......... max=["a", "a", "a"]
18:17:26.043 line   test/support/test.rb:48          max ? [max[0], max.size] : ["", 0]
18:17:26.043 return test/support/test.rb:49        end

The gem allows to wrap only a piece of code in a block:

class Test
  def shuffle(arr)
    for n in 0...arr.size
      targ = n + rand(arr.size - n)
      arr[n], arr[targ] = arr[targ], arr[n] if n != targ
    end
  end

  def pairs(a, b)
    with_blab do
      a << "Insane"
      shuffle(b)
    end
    b.each { |x| shuffle(a); a.each { |y| print y, " ", x, ".\n" } }
  end
end

Test.new.pairs(["Bored", "Curious"], ["cat", "frog"])

The output:

Var......... a=["Bored", "Curious"]
Var......... b=["cat", "frog"]
18:38:15.188 line   test/support/test.rb:54                   a << "Insane"
18:38:15.188 line   test/support/test.rb:55                   shuffle(b)
Var......... arr=["cat", "frog"]
18:38:15.188 call   test/support/test.rb:45               def shuffle(arr)
18:38:15.189 line   test/support/test.rb:46                 for n in 0...arr.size
Var......... n=0
18:38:15.189 line   test/support/test.rb:47                   targ = n + rand(arr.size - n)
Var......... targ=0
18:38:15.189 line   test/support/test.rb:48                   arr[n], arr[targ] = arr[targ], arr[n] if n != targ
Var......... n=1
18:38:15.189 line   test/support/test.rb:47                   targ = n + rand(arr.size - n)
Var......... targ=1
18:38:15.189 line   test/support/test.rb:48                   arr[n], arr[targ] = arr[targ], arr[n] if n != targ
18:38:15.189 return test/support/test.rb:50               end

Configuration

Output to a file:

Blab::Config.log_output = "log/blab.log"

Datetime format:

Blab::Config.datetime_format = "%H:%M:%S.%L"

Custom logger:

Blab::Config.logger = MyCustomLogger.new

Trace C calls your program makes from Ruby:

Blab::Config.trace_c_calls = true

Trace only within the original scope.
It means that the trace will be showed only for the current method and it will skip all external call's traces.

Blab::Config.original_scope_only = true

Format output. Available config is:

output_order = [
  { type: :time, order: 1, width: 12 },
  { type: :event, order: 2, width: 6 },
  { type: :file_lines, order: 3, width: 30 },
  { type: :class_name, order: 4, width: 10 },
  { type: :method_name, order: 5, width: 12 },
  { type: :code_lines, order: 7, width: 120 }
]

Blab::Config.output_order = output_order

By default it doesn't show current class name and method name. You can adjust the width, change the order, skip/add the desired output info.

Contribution

Fork & Pull Request.
Run the tests via rake.

License

MIT

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].