├── .gitignore
├── .ruby-gemset
├── .ruby-version
├── .travis.yml
├── Gemfile
├── LICENSE
├── README.md
├── Rakefile
├── bin
└── react-native-logcat
├── extras
├── screenshot.png
├── screenshot2.png
└── thumbnail.jpg
├── lib
├── react-native-logcat.rb
└── react-native-logcat
│ └── version.rb
└── react-native-logcat.gemspec
/.gitignore:
--------------------------------------------------------------------------------
1 | /.bundle/
2 | /.yardoc
3 | /Gemfile.lock
4 | /_yardoc/
5 | /coverage/
6 | /doc/
7 | /pkg/
8 | /spec/reports/
9 | /tmp/
10 |
--------------------------------------------------------------------------------
/.ruby-gemset:
--------------------------------------------------------------------------------
1 | yo
2 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | 2.3.0
2 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 2.2.3
4 | before_install: gem install bundler -v 1.10.6
5 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in react-native-logcat.gemspec
4 | gemspec
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 César Ferreira
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native logcat [](http://badge.fury.io/rb/react-native-logcat)
2 |
3 | > Filter the react native android logcat
4 |
5 |
6 |
7 |
8 |
9 | ## Usage
10 |
11 | > react-native-logcat
12 |
13 | ## Installation
14 |
15 | $ gem install react-native-logcat
16 |
17 | **Requirements `(if you haven't already)`:**
18 |
19 | > Android SDK in your $PATH [(how-to)](http://stackoverflow.com/questions/19986214/setting-android-home-enviromental-variable-on-mac-os-x)
20 |
21 | ## Contributing
22 |
23 | 1. Fork it ( https://github.com/cesarferreira/react-native-logcat/fork )
24 | 2. Create your feature branch (`git checkout -b my-new-feature`)
25 | 3. Commit your changes (`git commit -am 'Add some feature'`)
26 | 4. Push to the branch (`git push origin my-new-feature`)
27 | 5. Create a new Pull Request
28 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require 'bundler/gem_tasks'
2 |
--------------------------------------------------------------------------------
/bin/react-native-logcat:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | lib = File.expand_path('../../lib', __FILE__)
4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5 |
6 | require "react-native-logcat"
7 |
8 | trap("SIGINT") { throw :ctrl_c }
9 |
10 | catch :ctrl_c do
11 | begin
12 | ReactNativeLogCat.start
13 | rescue SystemExit, Interrupt
14 | raise
15 | rescue Exception => e
16 | puts "Ok, i'll go!"
17 | puts e
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/extras/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarferreira/react-native-logcat/b8647ce3cefd314beb23062d727eacd51ab40d93/extras/screenshot.png
--------------------------------------------------------------------------------
/extras/screenshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarferreira/react-native-logcat/b8647ce3cefd314beb23062d727eacd51ab40d93/extras/screenshot2.png
--------------------------------------------------------------------------------
/extras/thumbnail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarferreira/react-native-logcat/b8647ce3cefd314beb23062d727eacd51ab40d93/extras/thumbnail.jpg
--------------------------------------------------------------------------------
/lib/react-native-logcat.rb:
--------------------------------------------------------------------------------
1 | require 'open3'
2 | require 'colorize'
3 |
4 | module ReactNativeLogCat
5 |
6 | def self.add_timestamp(str)
7 | timestamp = Time.now.strftime("%H:%M:%S")
8 | return "[#{timestamp}] #{str}"
9 | end
10 |
11 | def self.clean(str)
12 | return str[/^[A-Z]\/.*\):(.*)/,1]
13 | end
14 |
15 | def self.transform_line(str)
16 |
17 | if str[0..1] == "D/"
18 | return add_timestamp(clean(str).green)
19 | end
20 |
21 | if str[0..1] == "W/"
22 | return add_timestamp(clean(str).yellow)
23 | end
24 |
25 | if str[0..1] == "E/"
26 | return add_timestamp(clean(str).red)
27 | end
28 |
29 | if str[0..1] == "I/"
30 | return add_timestamp(clean(str).white)
31 | end
32 |
33 | return add_timestamp(str)
34 | end
35 |
36 | def self.start
37 | cmd='
38 | adb logcat *:S ReactNative:V ReactNativeJS:V | {
39 | while IFS= read -r line
40 | do
41 | echo "$line"
42 | done
43 | }'
44 |
45 | IO.popen(cmd).each do |line|
46 | puts self.transform_line(line.chomp)
47 | end
48 | end
49 |
50 | end
51 |
--------------------------------------------------------------------------------
/lib/react-native-logcat/version.rb:
--------------------------------------------------------------------------------
1 | module ReactNativeLogCat
2 | VERSION = "0.2.5"
3 | end
4 |
--------------------------------------------------------------------------------
/react-native-logcat.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | lib = File.expand_path('../lib', __FILE__)
3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4 | require 'react-native-logcat/version'
5 |
6 | Gem::Specification.new do |spec|
7 | spec.name = "react-native-logcat"
8 | spec.version = ReactNativeLogCat::VERSION
9 | spec.authors = ["cesar ferreira"]
10 | spec.email = ["cesar.manuel.ferreira@gmail.com"]
11 |
12 | spec.summary = %q{Colored logcat for react native}
13 | spec.description = %q{Colored logcat for react native}
14 | spec.homepage = "https://github.com/cesarferreira/react-native-logcat"
15 | spec.license = 'MIT'
16 |
17 |
18 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19 | spec.bindir = 'bin'
20 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21 | spec.require_paths = ['lib']
22 |
23 | spec.required_ruby_version = '>= 2.0.0'
24 |
25 |
26 | spec.add_development_dependency 'rake', '~> 10.4'
27 |
28 | spec.add_dependency 'bundler', '~> 1.7'
29 | spec.add_dependency 'colorize', '~> 0.7'
30 | end
31 |
--------------------------------------------------------------------------------