Skip to content

Commit 3f8ce55

Browse files
committed
feature/SCFF-24 removed files related to syslog
1 parent e46c93a commit 3f8ce55

12 files changed

Lines changed: 61 additions & 434 deletions

File tree

caching/caching_boltdb.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ package caching
22

33
import (
44
"fmt"
5+
56
"github.com/boltdb/bolt"
6-
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging"
7-
cfClient "github.com/cloudfoundry-community/go-cfclient"
8-
json "github.com/mailru/easyjson"
7+
//"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging"
98
"log"
109
"os"
1110
"time"
11+
12+
"github.com/cloudfoundry-community/firehose-to-syslog1/logging"
13+
cfClient "github.com/cloudfoundry-community/go-cfclient"
14+
json "github.com/mailru/easyjson"
1215
)
1316

1417
type CachingBolt struct {

eventRouting/eventRouting_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package eventRouting_test
33
import (
44
. "bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/caching/cachingfakes"
55
. "bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/eventRouting"
6-
. "bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging/loggingfakes"
76
. "bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/sumoCFFirehose/sumoLog4gofakes" //**
87
. "github.com/cloudfoundry/sonde-go/events"
98
. "github.com/onsi/ginkgo"
@@ -15,10 +14,10 @@ var _ = Describe("Events", func() {
1514
var eventRouting *EventRouting
1615

1716
BeforeEach(func() {
18-
logging := new(FakeLogging)
17+
//*logging := new(FakeLogging)
1918
caching := new(FakeCaching)
2019
sLAppender := new(FakeSumoLog4go)
21-
eventRouting = NewEventRouting(caching, logging, sLAppender)
20+
eventRouting = NewEventRouting(caching, sLAppender)
2221
eventRouting.SetupEventRouting("")
2322

2423
})

eventRouting/eventrouting.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/caching"
1212
fevents "bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/events"
13-
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/extrafields"
14-
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging"
15-
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/sumoCFFirehose" //**
13+
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/sumoCFFirehose"
1614
"github.com/Sirupsen/logrus"
15+
"github.com/cloudfoundry-community/firehose-to-syslog1/extrafields"
16+
"github.com/cloudfoundry-community/firehose-to-syslog1/logging"
1717
"github.com/cloudfoundry/sonde-go/events"
1818
)
1919

@@ -23,19 +23,19 @@ type EventRouting struct {
2323
selectedEventsCount map[string]uint64
2424
mutex *sync.Mutex
2525
sLAppender sumoCFFirehose.SumoCFFirehose //**
26-
log logging.Logging
27-
ExtraFields map[string]string
26+
//*log logging.Logging
27+
ExtraFields map[string]string
2828
}
2929

30-
func NewEventRouting(caching caching.Caching, logging logging.Logging, sLAppender sumoCFFirehose.SumoCFFirehose) *EventRouting {
30+
func NewEventRouting(caching caching.Caching, sLAppender sumoCFFirehose.SumoCFFirehose) *EventRouting {
3131
return &EventRouting{
3232
CachingClient: caching,
3333
selectedEvents: make(map[string]bool),
3434
selectedEventsCount: make(map[string]uint64),
3535
sLAppender: sLAppender, //**
36-
log: logging,
37-
mutex: &sync.Mutex{},
38-
ExtraFields: make(map[string]string),
36+
//* log: logging,
37+
mutex: &sync.Mutex{},
38+
ExtraFields: make(map[string]string),
3939
}
4040
}
4141

@@ -80,8 +80,10 @@ func (e *EventRouting) RouteEvent(msg *events.Envelope) {
8080
if ignored, hasIgnoredField := event.Fields["cf_ignored_app"]; ignored == true && hasIgnoredField {
8181
e.selectedEventsCount["ignored_app_message"]++
8282
} else {
83-
e.sLAppender.AppendLogs(event.Fields) //**
84-
e.log.ShipEvents(event.Fields, event.Msg) // here we have to change the method for the one on sumoLogicAppender
83+
/*fmt.Printf("I'm in eventRpouting method .. -------")
84+
fmt.Println(event.Fields)
85+
fmt.Println(event.Msg)*/
86+
e.sLAppender.AppendLogs(event.Fields) //**/here we have to change the method for the one on sumoLogicAppender
8587
e.selectedEventsCount[eventType.String()]++
8688

8789
}
@@ -97,7 +99,7 @@ func (e *EventRouting) SetupEventRouting(wantedEvents string) error {
9799
for _, event := range strings.Split(wantedEvents, ",") {
98100
if e.isAuthorizedEvent(strings.TrimSpace(event)) {
99101
e.selectedEvents[strings.TrimSpace(event)] = true
100-
logging.LogStd(fmt.Sprintf("Event Type [%s] is included in the fireshose!", event), false)
102+
//logging.LogStd(fmt.Sprintf("Event Type [%s] is included in the fireshose!", event), false)
101103
} else {
102104
return fmt.Errorf("Rejected Event Name [%s] - Valid events: %s", event, GetListAuthorizedEventEvents())
103105
}
@@ -159,7 +161,8 @@ func (e *EventRouting) LogEventTotals(logTotalsTime time.Duration) {
159161
startTime = time.Now()
160162
event, lastCount := e.getEventTotals(totalElapsedTime, elapsedTime, count)
161163
count = lastCount
162-
e.log.ShipEvents(event.Fields, event.Msg)
164+
//*e.log.ShipEvents(event.Fields, event.Msg)
165+
e.sLAppender.AppendLogs(event.Fields)
163166
}
164167
}()
165168
}

extrafields/extrafields.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

extrafields/extrafields_suite_test.go

Lines changed: 0 additions & 67 deletions
This file was deleted.

firehoseclient/firehoseclient.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import (
55
"time"
66

77
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/eventRouting"
8-
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging"
8+
//*"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging"
9+
910
"github.com/cloudfoundry-community/go-cfclient"
1011
"github.com/cloudfoundry/noaa/consumer"
1112
"github.com/cloudfoundry/sonde-go/events"
@@ -75,22 +76,22 @@ func (f *FirehoseNozzle) handleError(err error) {
7576

7677
switch {
7778
case websocket.IsCloseError(err, websocket.CloseNormalClosure):
78-
logging.LogError("Normal Websocket Closure", err)
79+
//logging.LogError("Normal Websocket Closure", err)
7980
case websocket.IsCloseError(err, websocket.ClosePolicyViolation):
80-
logging.LogError("Error while reading from the firehose", err)
81-
logging.LogError("Disconnected because nozzle couldn't keep up. Please try scaling up the nozzle.", nil)
81+
//logging.LogError("Error while reading from the firehose", err)
82+
//logging.LogError("Disconnected because nozzle couldn't keep up. Please try scaling up the nozzle.", nil)
8283

8384
default:
84-
logging.LogError("Error while reading from the firehose", err)
85+
//logging.LogError("Error while reading from the firehose", err)
8586
}
8687

87-
logging.LogError("Closing connection with traffic controller due to error", err)
88+
//logging.LogError("Closing connection with traffic controller due to error", err)
8889
f.consumer.Close()
8990
}
9091

9192
func (f *FirehoseNozzle) handleMessage(envelope *events.Envelope) {
9293
if envelope.GetEventType() == events.Envelope_CounterEvent && envelope.CounterEvent.GetName() == "TruncatingBuffer.DroppedMessages" && envelope.GetOrigin() == "doppler" {
93-
logging.LogStd("We've intercepted an upstream message which indicates that the nozzle or the TrafficController is not keeping up. Please try scaling up the nozzle.", true)
94+
//logging.LogStd("We've intercepted an upstream message which indicates that the nozzle or the TrafficController is not keeping up. Please try scaling up the nozzle.", true)
9495
}
9596
}
9697

logging/logging.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

logging/logging_logrus.go

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)