code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
// Package tasks provides access to the Tasks API.
//
// See https://developers.google.com/google-apps/tasks/firstapp
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/tasks/v1"
// ...
// tasksService, err := tasks.New(oauthHttpClient)
package tasks
import (
"bytes"
"code.google.com/p/g... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"go/format"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"os/exec"
"path/filepath"
... | Go |
// Package taskqueue provides access to the TaskQueue API.
//
// See https://developers.google.com/appengine/docs/python/taskqueue/rest
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/taskqueue/v1beta1"
// ...
// taskqueueService, err := taskqueue.New(oauthHttpClient)
package taskqueue
... | Go |
// Package taskqueue provides access to the TaskQueue API.
//
// See https://developers.google.com/appengine/docs/python/taskqueue/rest
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/taskqueue/v1beta2"
// ...
// taskqueueService, err := taskqueue.New(oauthHttpClient)
package taskqueue
... | Go |
// Package appstate provides access to the Google App State API.
//
// See https://developers.google.com/games/services/web/api/states
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/appstate/v1"
// ...
// appstateService, err := appstate.New(oauthHttpClient)
package appstate
import (
... | Go |
// Package blogger provides access to the Blogger API.
//
// See https://developers.google.com/blogger/docs/3.0/getting_started
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/blogger/v3"
// ...
// bloggerService, err := blogger.New(oauthHttpClient)
package blogger
import (
"bytes"
"c... | Go |
// Package blogger provides access to the Blogger API.
//
// See https://developers.google.com/blogger/docs/2.0/json/getting_started
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/blogger/v2"
// ...
// bloggerService, err := blogger.New(oauthHttpClient)
package blogger
import (
"bytes... | Go |
// Package coordinate provides access to the Google Maps Coordinate API.
//
// See https://developers.google.com/coordinate/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/coordinate/v1"
// ...
// coordinateService, err := coordinate.New(oauthHttpClient)
package coordinate
import (
"b... | Go |
// Package admin provides access to the Admin Reports API.
//
// See https://developers.google.com/admin-sdk/reports/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/admin/reports_v1"
// ...
// adminService, err := admin.New(oauthHttpClient)
package admin
import (
"bytes"
"code.google... | Go |
// Package admin provides access to the Email Migration API v2.
//
// See https://developers.google.com/admin-sdk/email-migration/v2/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/admin/email_migration_v2"
// ...
// adminService, err := admin.New(oauthHttpClient)
package admin
import ... | Go |
// Package admin provides access to the Admin Directory API.
//
// See https://developers.google.com/admin-sdk/directory/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/admin/directory_v1"
// ...
// adminService, err := admin.New(oauthHttpClient)
package admin
import (
"bytes"
"code.... | Go |
// Package groupssettings provides access to the Groups Settings API.
//
// See https://developers.google.com/google-apps/groups-settings/get_started
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/groupssettings/v1"
// ...
// groupssettingsService, err := groupssettings.New(oauthHttpCli... | Go |
// Package identitytoolkit provides access to the Google Identity Toolkit API.
//
// See https://developers.google.com/identity-toolkit/v3/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/identitytoolkit/v3"
// ...
// identitytoolkitService, err := identitytoolkit.New(oauthHttpClient)
pa... | Go |
// Package urlshortener provides access to the URL Shortener API.
//
// See http://code.google.com/apis/urlshortener/v1/getting_started.html
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/urlshortener/v1"
// ...
// urlshortenerService, err := urlshortener.New(oauthHttpClient)
package ur... | Go |
// Package licensing provides access to the Enterprise License Manager API.
//
// See https://developers.google.com/google-apps/licensing/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/licensing/v1"
// ...
// licensingService, err := licensing.New(oauthHttpClient)
package licensing
im... | Go |
// Package pagespeedonline provides access to the PageSpeed Insights API.
//
// See https://developers.google.com/speed/docs/insights/v1/getting_started
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/pagespeedonline/v1"
// ...
// pagespeedonlineService, err := pagespeedonline.New(oauthH... | Go |
// Package dfareporting provides access to the DFA Reporting API.
//
// See https://developers.google.com/doubleclick-advertisers/reporting/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/dfareporting/v1.3"
// ...
// dfareportingService, err := dfareporting.New(oauthHttpClient)
package ... | Go |
// Package dfareporting provides access to the DFA Reporting API.
//
// See https://developers.google.com/doubleclick-advertisers/reporting/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/dfareporting/v1.2"
// ...
// dfareportingService, err := dfareporting.New(oauthHttpClient)
package ... | Go |
// Package dfareporting provides access to the DFA Reporting API.
//
// See https://developers.google.com/doubleclick-advertisers/reporting/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/dfareporting/v1.1"
// ...
// dfareportingService, err := dfareporting.New(oauthHttpClient)
package ... | Go |
// Package dfareporting provides access to the DFA Reporting API.
//
// See https://developers.google.com/doubleclick-advertisers/reporting/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/dfareporting/v1"
// ...
// dfareportingService, err := dfareporting.New(oauthHttpClient)
package df... | Go |
// Package androidpublisher provides access to the Google Play Android Developer API.
//
// See https://developers.google.com/android-publisher
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/androidpublisher/v1.1"
// ...
// androidpublisherService, err := androidpublisher.New(oauthHttpC... | Go |
// Package androidpublisher provides access to the Google Play Android Developer API.
//
// See https://developers.google.com/android-publisher
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/androidpublisher/v1"
// ...
// androidpublisherService, err := androidpublisher.New(oauthHttpCli... | Go |
// Package androidpublisher provides access to the Google Play Android Developer API.
//
// See https://developers.google.com/android-publisher
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/androidpublisher/v2"
// ...
// androidpublisherService, err := androidpublisher.New(oauthHttpCli... | Go |
// Package books provides access to the Books API.
//
// See https://developers.google.com/books/docs/v1/getting_started
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/books/v1"
// ...
// booksService, err := books.New(oauthHttpClient)
package books
import (
"bytes"
"code.google.com/... | Go |
// Package prediction provides access to the Prediction API.
//
// See https://developers.google.com/prediction/docs/developer-guide
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/prediction/v1.3"
// ...
// predictionService, err := prediction.New(oauthHttpClient)
package prediction
im... | Go |
// Package prediction provides access to the Prediction API.
//
// See https://developers.google.com/prediction/docs/developer-guide
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/prediction/v1.2"
// ...
// predictionService, err := prediction.New(oauthHttpClient)
package prediction
im... | Go |
// Package prediction provides access to the Prediction API.
//
// See https://developers.google.com/prediction/docs/developer-guide
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/prediction/v1.6"
// ...
// predictionService, err := prediction.New(oauthHttpClient)
package prediction
im... | Go |
// Package prediction provides access to the Prediction API.
//
// See https://developers.google.com/prediction/docs/developer-guide
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/prediction/v1.5"
// ...
// predictionService, err := prediction.New(oauthHttpClient)
package prediction
im... | Go |
// Package prediction provides access to the Prediction API.
//
// See https://developers.google.com/prediction/docs/developer-guide
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/prediction/v1.4"
// ...
// predictionService, err := prediction.New(oauthHttpClient)
package prediction
im... | Go |
// Package orkut provides access to the Orkut API.
//
// See http://code.google.com/apis/orkut/v2/reference.html
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/orkut/v2"
// ...
// orkutService, err := orkut.New(oauthHttpClient)
package orkut
import (
"bytes"
"code.google.com/p/google... | Go |
// Package manager provides access to the Deployment Manager API.
//
// See https://developers.google.com/deployment-manager/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/manager/v1beta2"
// ...
// managerService, err := manager.New(oauthHttpClient)
package manager
import (
"bytes"
... | Go |
package main
import (
"log"
"net/http"
orkut "code.google.com/p/google-api-go-client/orkut/v2"
)
func init() {
registerDemo("orkut", orkut.OrkutScope, orkutMain)
}
func orkutMain(client *http.Client, argv []string) {
orkutapi, _ := orkut.New(client)
myBadges, err := orkutapi.Badges.List("me").Do()
if err != ... | Go |
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
urlshortener "code.google.com/p/google-api-go-client/urlshortener/v1"
)
func init() {
registerDemo("urlshortener", urlshortener.UrlshortenerScope, urlShortenerMain)
}
func urlShortenerMain(client *http.Client, argv []string) {
if len(argv) != 1 {
... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"encoding/gob"
"errors"
"flag"
"fmt"
"hash/fnv"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"net/url"
"os"
"os/exec"
"path/... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
"time"
mapsengine "code.google.com/p/google-api-go-client/mapsengine/v1"
)
func init() {
... | Go |
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
)
type logTransport struct {
rt http.RoundTripper
}
func (t *logTransport) RoundTrip(req *http.Request) (*http.Response, error) {
var buf bytes.Buffer
os.Stdout.Write([]byte("\n[request]\n"))
if req.Body != nil {
req.Body = ioutil.NopC... | Go |
package main
import (
"fmt"
"log"
"net/http"
"os"
storage "code.google.com/p/google-api-go-client/storage/v1beta1"
)
func init() {
registerDemo("storage", storage.DevstorageRead_writeScope, storageMain)
}
func storageMain(client *http.Client, argv []string) {
if len(argv) != 2 {
fmt.Fprintln(os.Stderr, "Us... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"net/http"
"os"
"path/filepath"
"strings"
"code.google.com/p/google-api-go-client/googleapi"
prediction "code.google... | Go |
package main
import (
"bufio"
"encoding/base64"
"encoding/json"
"fmt"
"log"
"net"
"net/http"
"net/textproto"
"os"
"strings"
pubsub "code.google.com/p/google-api-go-client/pubsub/v1beta1"
)
const USAGE = `Available arguments are:
PROJ list_topics
PROJ create_topic TOPIC
PROJ delete_topic TOPIC
... | Go |
package main
import (
"fmt"
"log"
"net/http"
"os"
drive "code.google.com/p/google-api-go-client/drive/v2"
)
func init() {
registerDemo("drive", drive.DriveScope, driveMain)
}
func driveMain(client *http.Client, argv []string) {
if len(argv) != 1 {
fmt.Fprintln(os.Stderr, "Usage: drive filename (to upload a... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"net/http"
"os"
calendar "code.google.com/p/google-api-go-client/calendar/v3"
)
func init() {
registerDemo("calendar"... | Go |
package main
import (
"log"
"net/http"
tasks "code.google.com/p/google-api-go-client/tasks/v1"
)
func init() {
registerDemo("tasks", tasks.TasksScope, tasksMain)
}
func tasksMain(client *http.Client, argv []string) {
taskapi, _ := tasks.New(client)
task, err := taskapi.Tasks.Insert("@default", &tasks.Task{
... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"container/list"
"encoding/json"
"fmt"
"io/ioutil"
"math"
"math/rand"
"net/http"
"os"
"strconv"
"strings"
"time"
"code.googl... | Go |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bufio"
"fmt"
"log"
"net/http"
"os"
"sort"
"strings"
gmail "code.google.com/p/google-api-go-client/gmail/v1"
)
func init() {
r... | Go |
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
compute "code.google.com/p/google-api-go-client/compute/v1"
)
func init() {
scopes := strings.Join([]string{
compute.DevstorageFull_controlScope,
compute.ComputeScope,
}, " ")
registerDemo("compute", scopes, computeMain)
}
func computeMain(cli... | Go |
// Package civicinfo provides access to the Google Civic Information API.
//
// See https://developers.google.com/civic-information
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/civicinfo/us_v1"
// ...
// civicinfoService, err := civicinfo.New(oauthHttpClient)
package civicinfo
import... | Go |
// Package civicinfo provides access to the Google Civic Information API.
//
// See https://developers.google.com/civic-information
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/civicinfo/v1"
// ...
// civicinfoService, err := civicinfo.New(oauthHttpClient)
package civicinfo
import (
... | Go |
// Package genomics provides access to the Genomics API.
//
// See https://developers.google.com/genomics/v1beta/reference
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/genomics/v1beta"
// ...
// genomicsService, err := genomics.New(oauthHttpClient)
package genomics
import (
"bytes"
... | Go |
// Package webfonts provides access to the Google Fonts Developer API.
//
// See https://developers.google.com/fonts/docs/developer_api
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/webfonts/v1"
// ...
// webfontsService, err := webfonts.New(oauthHttpClient)
package webfonts
import (
... | Go |
// Package qpxexpress provides access to the QPX Express API.
//
// See http://developers.google.com/qpx-express
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/qpxexpress/v1"
// ...
// qpxexpressService, err := qpxexpress.New(oauthHttpClient)
package qpxexpress
import (
"bytes"
"code... | Go |
// Package customsearch provides access to the CustomSearch API.
//
// See https://developers.google.com/custom-search/v1/using_rest
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/customsearch/v1"
// ...
// customsearchService, err := customsearch.New(oauthHttpClient)
package customsear... | Go |
// Package doubleclickbidmanager provides access to the DoubleClick Bid Manager API.
//
// See https://developers.google.com/bid-manager/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/doubleclickbidmanager/v1"
// ...
// doubleclickbidmanagerService, err := doubleclickbidmanager.New(oau... | Go |
// Package bigquery provides access to the BigQuery API.
//
// See https://developers.google.com/bigquery/docs/overview
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/bigquery/v2"
// ...
// bigqueryService, err := bigquery.New(oauthHttpClient)
package bigquery
import (
"bytes"
"code.... | Go |
// Package autoscaler provides access to the Google Compute Engine Autoscaler API.
//
// See http://developers.google.com/compute/docs/autoscaler
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/autoscaler/v1beta2"
// ...
// autoscalerService, err := autoscaler.New(oauthHttpClient)
packag... | Go |
// Package youtubeanalytics provides access to the YouTube Analytics API.
//
// See http://developers.google.com/youtube/analytics/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/youtubeanalytics/v1beta1"
// ...
// youtubeanalyticsService, err := youtubeanalytics.New(oauthHttpClient)
pa... | Go |
// Package youtubeanalytics provides access to the YouTube Analytics API.
//
// See http://developers.google.com/youtube/analytics/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/youtubeanalytics/v1"
// ...
// youtubeanalyticsService, err := youtubeanalytics.New(oauthHttpClient)
package... | Go |
// Package resourceviews provides access to the Resource Views API.
//
// See https://developers.google.com/compute/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/resourceviews/v1beta1"
// ...
// resourceviewsService, err := resourceviews.New(oauthHttpClient)
package resourceviews
imp... | Go |
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package googleapi contains the common code shared by all Google API
// libraries.
package googleapi
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"... | Go |
// Copyright 2013 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package googleapi
import (
"encoding/json"
"strconv"
)
// Int64s is a slice of int64s that marshal as quoted strings in JSON.
type Int64s []int64
func (q *Int6... | Go |
// Copyright 2012 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package transport contains HTTP transports used to make
// authenticated API requests.
package transport
import (
"errors"
"net/http"
)
// APIKey is an HTTP ... | Go |
package uritemplates
func Expand(path string, expansions map[string]string) (string, error) {
template, err := Parse(path)
if err != nil {
return "", err
}
values := make(map[string]interface{})
for k, v := range expansions {
values[k] = v
}
return template.Expand(values)
}
| Go |
// Copyright 2013 Joshua Tacoma. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package uritemplates is a level 4 implementation of RFC 6570 (URI
// Template, http://tools.ietf.org/html/rfc6570).
//
// To use uritemplates, parse a templat... | Go |
// Package appsactivity provides access to the Google Apps Activity API.
//
// See https://developers.google.com/google-apps/activity/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/appsactivity/v1"
// ...
// appsactivityService, err := appsactivity.New(oauthHttpClient)
package appsacti... | Go |
// Package adsensehost provides access to the AdSense Host API.
//
// See https://developers.google.com/adsense/host/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/adsensehost/v4.1"
// ...
// adsensehostService, err := adsensehost.New(oauthHttpClient)
package adsensehost
import (
"by... | Go |
// Package groupsmigration provides access to the Groups Migration API.
//
// See https://developers.google.com/google-apps/groups-migration/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/groupsmigration/v1"
// ...
// groupsmigrationService, err := groupsmigration.New(oauthHttpClient)
... | Go |
// Package doubleclicksearch provides access to the DoubleClick Search API.
//
// See https://developers.google.com/doubleclick-search/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/doubleclicksearch/v2"
// ...
// doubleclicksearchService, err := doubleclicksearch.New(oauthHttpClient)
... | Go |
// Package pubsub provides access to the Cloud Pub/Sub API.
//
// See https://developers.google.com/pubsub/v1beta1
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/pubsub/v1beta1"
// ...
// pubsubService, err := pubsub.New(oauthHttpClient)
package pubsub
import (
"bytes"
"code.google.c... | Go |
// Package mapsengine provides access to the Google Maps Engine API.
//
// See https://developers.google.com/maps-engine/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/mapsengine/v1"
// ...
// mapsengineService, err := mapsengine.New(oauthHttpClient)
package mapsengine
import (
"byte... | Go |
// Package mapsengine provides access to the Google Maps Engine API.
//
// See https://developers.google.com/maps-engine/
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/mapsengine/exp2"
// ...
// mapsengineService, err := mapsengine.New(oauthHttpClient)
package mapsengine
import (
"by... | Go |
package hello
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, world!")
} | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Hello is a trivial example of a main package.
package main
import (
"fmt"
"code.google.com/p/go.example/newmath"
)
func main() {
fmt.Printf("Hello, wo... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package newmath is a trivial example package.
package newmath
// Sqrt returns an approximation to the square root of x.
func Sqrt(x float64) float64 {
// ... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"io"
"os"
"fmt"
)
// This is the standard writer that prints to standard output.
type ConsoleLogWriter chan *LogRecord
// This creates a new ConsoleLogWriter
func NewConsoleLogWriter() ConsoleLogWriter {
reco... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"bytes"
"fmt"
"io"
"time"
)
const (
FORMAT_DEFAULT = "[%D %T] [%L] (%S) %M"
FORMAT_SHORT = "[%t %d] [%L] %M"
FORMAT_ABBREV = "[%L] %M"
)
var (
// TimeConversionFunction specifies what function to call ... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"errors"
"fmt"
"os"
"strings"
)
var (
Global Logger
)
func init() {
Global = NewDefaultLogger(DEBUG)
}
// Wrapper for (*Logger).LoadConfiguration
func LoadConfiguration(filename string) {
Global.LoadConfi... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"fmt"
"os"
"time"
)
// This log writer sends output to a file
type FileLogWriter struct {
rec chan *LogRecord
rot chan bool
// The opened file
filename string
file *os.File
// The logging format
fo... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
)
type xmlProperty struct {
Name string `xml:"attr"`
Value string `xml:"chardata"`
}
type xmlFilter struct {
Enabled string `xml:"attr"`
Tag ... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
// Enhanced Logging
//
// This is inspired by the logging functionality in Java. Essentially, you create a Logger
// object and create output filters for it. You can send whatever you want to the Logger,
// and it will filter that based ... | Go |
package main
import (
"flag"
"fmt"
"net"
"os"
)
var (
port = flag.String("p", "12124", "Port number to listen on")
)
func e(err error) {
if err != nil {
fmt.Printf("Erroring out: %s\n", err)
os.Exit(1)
}
}
func main() {
flag.Parse()
// Bind to the port
bind, err := net.ResolveUDPAddr("0.0.0.0:" + *po... | Go |
package main
import (
"time"
)
import l4g "code.google.com/p/log4go/stable"
func main() {
log := l4g.NewLogger()
log.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter())
log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
}
| Go |
package main
import (
"time"
)
import l4g "code.google.com/p/log4go/stable"
func main() {
log := l4g.NewLogger()
log.AddFilter("network", l4g.FINEST, l4g.NewSocketLogWriter("udp", "192.168.1.255:12124"))
// Run `nc -u -l -p 12124` or similar before you run this to see the following message
log.Info("The time i... | Go |
package main
import (
"bufio"
"fmt"
"io"
"os"
"time"
)
import l4g "code.google.com/p/log4go/stable"
const (
filename = "flw.log"
)
func main() {
// Get a new logger instance
log := l4g.NewLogger()
// Create a default logger that is logging messages of FINE or higher
log.AddFilter("file", l4g.FINE, l4g.Ne... | Go |
package main
import l4g "code.google.com/p/log4go/stable"
func main() {
// Load the configuration (isn't this easy?)
l4g.LoadConfiguration("example.xml")
// And now we're ready!
l4g.Finest("This will only go to those of you really cool UDP kids! If you change enabled=true.")
l4g.Debug("Oh no! %d + %d = %d!", ... | Go |
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved.
package log4go
import (
"encoding/json"
"fmt"
"net"
"os"
)
// This log writer sends output to a socket
type SocketLogWriter chan *LogRecord
// This is the SocketLogWriter's output method
func (w SocketLogWriter) LogWrite(rec *LogRec... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.