Piston 2.0 Progress: Much saner logging
Instead of using Logger, I’m now using Log4r. This is a departure for me, as I initially gave myself the goal of not depending on too many libraries. But since I’m already depending on Main (which itself has 2 dependencies) and open4, I thought, “why not another one ?”
But this new dependency gives me much greater freedom in logging. I’m not done coding all of this, but —verbose won’t just be a flag. It will represent a level, and the higher the level, the more logging will be done. Obvious, but much more interesting.
Anyway, here’s what 1.9.1 was logging for a simple svn/git pistonization:
1 $ ruby -I lib bin/piston import http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 2 D, [2008-03-25T00:41:13.494826 #13759] DEBUG -- : Piston::Commands::Import with options {:verbose=>false, :force=>false, :quiet=>false, :lock=>false, :dry_run=>false} 3 D, [2008-03-25T00:41:13.495078 #13759] DEBUG -- : Guessing the repository type of "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement" 4 D, [2008-03-25T00:41:13.495386 #13759] DEBUG -- : git ls-remote --heads http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 5 D, [2008-03-25T00:41:13.495543 #13759] DEBUG -- : > "git ls-remote --heads http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement" 6 D, [2008-03-25T00:41:13.721569 #13759] DEBUG -- : > #<Process::Status: pid=13760,exited(1)>, success? false, status: 1 7 D, [2008-03-25T00:41:13.722096 #13759] DEBUG -- : svn info http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 8 D, [2008-03-25T00:41:19.142407 #13759] DEBUG -- : Path: ssl_requirement 9 URL: http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 10 Repository Root: http://dev.rubyonrails.org/svn/rails 11 Repository UUID: 5ecf4fe2-1ee6-0310-87b1-e25e094e27de 12 Revision: 9088 13 Node Kind: directory 14 Last Changed Author: bitsweat 15 Last Changed Rev: 8780 16 Last Changed Date: 2008-02-02 00:16:53 -0500 (Sat, 02 Feb 2008) 17 18 19 D, [2008-03-25T00:41:19.142810 #13759] DEBUG -- : Guessing the working copy type of #<Pathname:repository> 20 D, [2008-03-25T00:41:19.142950 #13759] DEBUG -- : Asking Piston::Git::WorkingCopy if it understands repository 21 D, [2008-03-25T00:41:19.143063 #13759] DEBUG -- : git status on repository 22 D, [2008-03-25T00:41:19.143490 #13759] DEBUG -- : git status on . 23 D, [2008-03-25T00:41:19.143681 #13759] DEBUG -- : git status 24 D, [2008-03-25T00:41:19.143848 #13759] DEBUG -- : > "git status" 25 D, [2008-03-25T00:41:19.166951 #13759] DEBUG -- : > #<Process::Status: pid=13772,exited(1)>, success? false, status: 1 26 D, [2008-03-25T00:41:19.167193 #13759] DEBUG -- : # On branch my1.9.1 27 nothing to commit (working directory clean) 28 29 D, [2008-03-25T00:41:19.167443 #13759] DEBUG -- : Initialized on repository 30 D, [2008-03-25T00:41:19.167920 #13759] DEBUG -- : svn checkout --revision HEAD http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement .repository.tmp 31 D, [2008-03-25T00:41:25.100301 #13759] DEBUG -- : A .repository.tmp/test 32 A .repository.tmp/test/ssl_requirement_test.rb 33 A .repository.tmp/lib 34 A .repository.tmp/lib/ssl_requirement.rb 35 A .repository.tmp/README 36 Checked out revision 9088. 37 38 D, [2008-03-25T00:41:25.100986 #13759] DEBUG -- : svn ls --recursive .repository.tmp 39 D, [2008-03-25T00:41:30.056625 #13759] DEBUG -- : README 40 lib/ 41 lib/ssl_requirement.rb 42 test/ 43 test/ssl_requirement_test.rb 44 45 D, [2008-03-25T00:41:30.057107 #13759] DEBUG -- : Copying README to repository/README 46 D, [2008-03-25T00:41:30.058074 #13759] DEBUG -- : Copying lib/ssl_requirement.rb to repository/lib/ssl_requirement.rb 47 D, [2008-03-25T00:41:30.058994 #13759] DEBUG -- : Copying test/ssl_requirement_test.rb to repository/test/ssl_requirement_test.rb 48 D, [2008-03-25T00:41:30.059800 #13759] DEBUG -- : svn info --revision 9088 http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 49 D, [2008-03-25T00:41:34.750474 #13759] DEBUG -- : Path: ssl_requirement 50 URL: http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 51 Repository Root: http://dev.rubyonrails.org/svn/rails 52 Repository UUID: 5ecf4fe2-1ee6-0310-87b1-e25e094e27de 53 Revision: 9088 54 Node Kind: directory 55 Last Changed Author: bitsweat 56 Last Changed Rev: 8780 57 Last Changed Date: 2008-02-02 00:16:53 -0500 (Sat, 02 Feb 2008) 58 59 60 D, [2008-03-25T00:41:34.751037 #13759] DEBUG -- : Remembering {"piston:remote-revision"=>9088, "piston:root"=>"http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement", "piston:uuid"=>"5ecf4fe2-1ee6-0310-87b1-e25e094e27de"} 61 D, [2008-03-25T00:41:34.752256 #13759] DEBUG -- : Calling #after_remember on repository/.piston.yml 62 D, [2008-03-25T00:41:34.752475 #13759] DEBUG -- : git add . 63 D, [2008-03-25T00:41:34.752605 #13759] DEBUG -- : > "git add ." 64 D, [2008-03-25T00:41:34.758728 #13759] DEBUG -- : > #<Process::Status: pid=13785,exited(0)>, success? true, status: 0 65 D, [2008-03-25T00:41:34.758993 #13759] DEBUG -- : Removing temporary directory: .repository.tmp
And here’s the current master branch:
1 $ ruby -I lib bin/piston import http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement 2 INFO main: Guessing the repository type 3 INFO main: Guessing the working copy type 4 INFO main: Checking out the repository 5 INFO main: Copying from Piston::Revision(http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement@9088) 6 INFO main: Checked out "http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement" r9088 to "ssl_requirement"
Obviously, in 1.9.1, I hadn’t configured the logger at all, and everything was logged. Not so anymore !