From 2e56f9c8e170e2883a5577c69542d2f03de8cfb8 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 28 Sep 2010 04:25:11 -0700 Subject: Add code to determine lines in cached log. --- lognotify.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lognotify.rb b/lognotify.rb index da78f58..9d26836 100755 --- a/lognotify.rb +++ b/lognotify.rb @@ -7,6 +7,7 @@ # Distributed under the terms of the GNU General Public License v3. # See http://www.gnu.org/licenses/gpl.txt for the full license text. +CACHE_DIR="~/.cache/lognotify" CONFIG_DIR="~/.config/lognotify" # Configuration file parser. @@ -34,7 +35,13 @@ def parse identifier return conf end +# Output all messages immediately, as opposed to buffering. +STDOUT.sync = true + # Test code... ARGV.each do |identifier| - puts parse(identifier).inspect + print '* Determining number of lines in cached log... ' + file = File.expand_path(CACHE_DIR + '/' + identifier + '.log') + lines = File.open(file).readlines.length + puts lines end -- cgit v1.2.3-70-g09d2