Skip to content

Commit

Permalink
Use log.std and just optionally attach syslog to it.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Oct 15, 2012
1 parent f731c3d commit a404ea2
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"flag"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"sort"
Expand Down
1 change: 1 addition & 0 deletions database.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"log"
"net/http"

// Alias this because we call our connection couchbase
Expand Down
1 change: 1 addition & 0 deletions dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"log"
"net"
"strconv"
"strings"
Expand Down
1 change: 1 addition & 0 deletions files.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion frames.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"errors"
"flag"
"log"
"net"
"net/http"
"sync"
Expand Down Expand Up @@ -133,7 +134,6 @@ func connectNewFramesClient(addr string) *frameClient {
frt := &framesweb.FramesRoundTripper{
Dialer: conn,
Timeout: time.Second * 5,
Logger: log,
}
hc := &http.Client{Transport: frt}
frameClientsLock.Lock()
Expand Down
1 change: 1 addition & 0 deletions fsck.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"log"
"net/http"
)

Expand Down
1 change: 1 addition & 0 deletions hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"hash"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
Expand Down
1 change: 1 addition & 0 deletions heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"errors"
"fmt"
"log"
"net"
"net/url"
"strings"
Expand Down
1 change: 1 addition & 0 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
Expand Down
1 change: 1 addition & 0 deletions http_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"math/rand"
"net/http"
"net/url"
Expand Down
1 change: 1 addition & 0 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"log"
"strings"
)

Expand Down
14 changes: 3 additions & 11 deletions logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,16 @@
package main

import (
corelog "log"
"log"
"log/syslog"
"os"
)

var log *corelog.Logger

func init() {
log = corelog.New(os.Stderr, "", 0)
log.SetFlags(corelog.LstdFlags)
}

func initLogger(slog bool) {
if slog {
lw, err := syslog.New(syslog.LOG_INFO, "cbfs")
if err != nil {
corelog.Fatalf("Can't initialize logger: %v", err)
log.Fatalf("Can't initialize syslog: %v", err)
}
log = corelog.New(lw, "", 0)
log.SetOutput(lw)
}
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"flag"
"fmt"
"log"
"math/rand"
"net/http"
"os"
Expand Down
1 change: 1 addition & 0 deletions nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"math/rand"
"net/http"
"sort"
Expand Down
1 change: 1 addition & 0 deletions tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"archive/tar"
"compress/gzip"
"log"
"net/http"
)

Expand Down
1 change: 1 addition & 0 deletions tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"flag"
"fmt"
"log"
"math/rand"
"strings"
"time"
Expand Down
1 change: 1 addition & 0 deletions zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"archive/zip"
"encoding/json"
"errors"
"log"
"net/http"
"strings"

Expand Down

0 comments on commit a404ea2

Please sign in to comment.