summaryrefslogtreecommitdiff
path: root/lognotify.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-09-28 04:25:11 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-09-28 04:25:11 -0700
commit2e56f9c8e170e2883a5577c69542d2f03de8cfb8 (patch)
treebb60a8dc719f28ad39985e69d2fb49951b6263db /lognotify.rb
parentd3a6674d8e350f8005fab5b5c184262509a3bc60 (diff)
downloadlognotify-2e56f9c8e170e2883a5577c69542d2f03de8cfb8.tar.gz
lognotify-2e56f9c8e170e2883a5577c69542d2f03de8cfb8.tar.xz
Add code to determine lines in cached log.
Diffstat (limited to 'lognotify.rb')
-rwxr-xr-xlognotify.rb9
1 files changed, 8 insertions, 1 deletions
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