logflume 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/logflume/flume.rb +2 -2
- data/lib/logflume/version.rb +1 -1
- data/spec/logflume/logflume_spec.rb +27 -3
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b9da57924e169b16d9a60e2c2bfcb2a064616c20
         | 
| 4 | 
            +
              data.tar.gz: a30c52e9ab1f24dbb61723f5b5c79f5511298b58
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9903e43a942a5e853d8baf4897e522a20657c48dc30e0632076a97c4aa4916e4ea669d0fc677c0a41898dd5de8d9d96b7488a38e29c63af11041011cd53aeb20
         | 
| 7 | 
            +
              data.tar.gz: d9a62e4417d339397d7fe48cd177a73aa7e890bb36ea5cfc7803387d2eb0a8551173d514ec6e55da79ac9cfd94f907a6d643f88c79781946dc449a22686c86c6
         | 
    
        data/lib/logflume/flume.rb
    CHANGED
    
    | @@ -106,8 +106,8 @@ module Logflume | |
| 106 106 | 
             
                    mytime = Time.now
         | 
| 107 107 | 
             
                    #template("$SOURCEIP|$FACILITY|$PRIORITY|$LEVEL|$TAG|$YEAR-$MONTH-$DAY|$HOUR:$MIN:$SEC|$PROGRAM| $MSG\n")
         | 
| 108 108 | 
             
                    #@syslog_priority = @syslog_facility * 8 + @syslog_severity
         | 
| 109 | 
            -
                    ymd =  | 
| 110 | 
            -
                    hms =  | 
| 109 | 
            +
                    ymd = mytime.strftime("%Y-%M-%d")
         | 
| 110 | 
            +
                    hms = mytime.strftime("%H:%m:%S")
         | 
| 111 111 | 
             
                    @tag = "logflume"
         | 
| 112 112 | 
             
                    return "#{@syslog_sourceip}|#{@syslog_facility}|#{@syslog_priority}|#{@syslog_level}|#{@tag}|#{ymd}|#{hms}|#{@syslog_progname}| "
         | 
| 113 113 | 
             
                end
         | 
    
        data/lib/logflume/version.rb
    CHANGED
    
    
| @@ -12,9 +12,33 @@ describe Logflume do | |
| 12 12 | 
             
                flume.shutdown
         | 
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 | 
            +
              it 'handles fifo pipes' do
         | 
| 16 | 
            +
                flume = Logflume::Flume.new
         | 
| 17 | 
            +
                flume.dir='spec/data/flume'
         | 
| 18 | 
            +
                flume.glob='*.log'
         | 
| 19 | 
            +
                flume.pipe="/tmp/tmp.flume.#{$$}.fifo"
         | 
| 20 | 
            +
                flume.logger = Logger.new('/dev/null')
         | 
| 21 | 
            +
                expect(flume.start.class.to_s).to eq 'DirectoryWatcher'
         | 
| 22 | 
            +
                flume.shutdown
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              it 'prepends syslog when instructed when making a pipe' do
         | 
| 26 | 
            +
                flume = Logflume::Flume.new
         | 
| 27 | 
            +
                flume.dir='spec/data/flume'
         | 
| 28 | 
            +
                flume.glob='*.log'
         | 
| 29 | 
            +
                flume.pipe="/tmp/tmp.flume.#{$$}.fifo"
         | 
| 30 | 
            +
                flume.logger = Logger.new('/dev/null')
         | 
| 31 | 
            +
                flume.prefix_syslog=true
         | 
| 32 | 
            +
                flume.syslog_progname="dpkg"
         | 
| 33 | 
            +
                #flume.blocking = true
         | 
| 34 | 
            +
                expect(flume.start.class.to_s).to eq 'DirectoryWatcher'
         | 
| 35 | 
            +
                sleep(10) ## We need to ba able to catch PROC errors here.. 
         | 
| 36 | 
            +
                flume.shutdown
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
             | 
| 15 39 | 
             
              it 'should raise an InvalidDirectory Error' do
         | 
| 16 40 | 
             
                flume = Logflume::Flume.new
         | 
| 17 | 
            -
                flume.dir='spec/data/ | 
| 41 | 
            +
                flume.dir='spec/data/missingdirectory'
         | 
| 18 42 | 
             
                flume.glob='*.log'
         | 
| 19 43 | 
             
                expect{flume.start}.to raise_error(Logflume::InvalidDirectory)
         | 
| 20 44 | 
             
              end
         | 
| @@ -27,7 +51,7 @@ describe Logflume do | |
| 27 51 | 
             
                flume.start
         | 
| 28 52 | 
             
                #FileUtils.touch('spec/data/flume/test.log')
         | 
| 29 53 | 
             
                expect(flume.shutdown).to eq true
         | 
| 30 | 
            -
             | 
| 54 | 
            +
             | 
| 31 55 | 
             
              end
         | 
| 32 56 |  | 
| 33 | 
            -
            end
         | 
| 57 | 
            +
            end
         |