本文整理匯總了Golang中github.com/omniscale/imposm3/logging.NewLogger函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewLogger函數的具體用法?Golang NewLogger怎麽用?Golang NewLogger使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewLogger函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Error
package postgis
import (
"database/sql"
"fmt"
pq "github.com/lib/pq"
"github.com/omniscale/imposm3/database"
"github.com/omniscale/imposm3/element"
"github.com/omniscale/imposm3/logging"
"github.com/omniscale/imposm3/mapping"
"runtime"
"strings"
"sync/atomic"
)
var log = logging.NewLogger("PostGIS")
type SQLError struct {
query string
originalError error
}
func (e *SQLError) Error() string {
return fmt.Sprintf("SQL Error: %s in query %s", e.originalError.Error(), e.query)
}
type SQLInsertError struct {
SQLError
data interface{}
}
示例2: tileBounds
package limit
import (
"errors"
"math"
"os"
"strings"
"sync"
"github.com/omniscale/imposm3/geom/geojson"
"github.com/omniscale/imposm3/geom/geos"
"github.com/omniscale/imposm3/logging"
"github.com/omniscale/imposm3/proj"
)
var log = logging.NewLogger("limiter")
// Tile bbox into multiple sub-boxes, each of `width` size.
// >>> list(tile_bbox((-1, 1, 0.49, 1.51), 0.5)) #doctest: +NORMALIZE_WHITESPACE
// [(-1.0, 1.0, -0.5, 1.5),
// (-1.0, 1.5, -0.5, 2.0),
// (-0.5, 1.0, 0.0, 1.5),
// (-0.5, 1.5, 0.0, 2.0),
// (0.0, 1.0, 0.5, 1.5),
// (0.0, 1.5, 0.5, 2.0)]
func tileBounds(bounds geos.Bounds, width float64) []geos.Bounds {
var results []geos.Bounds
minX := math.Floor(bounds.MinX/width) * width
minY := math.Floor(bounds.MinY/width) * width
maxX := math.Ceil(bounds.MaxX/width) * width
示例3: init
"runtime"
"strconv"
"strings"
"sync"
osmcache "github.com/omniscale/imposm3/cache"
"github.com/omniscale/imposm3/element"
"github.com/omniscale/imposm3/geom/geos"
"github.com/omniscale/imposm3/geom/limit"
"github.com/omniscale/imposm3/logging"
"github.com/omniscale/imposm3/mapping"
"github.com/omniscale/imposm3/parser/pbf"
"github.com/omniscale/imposm3/stats"
)
var log = logging.NewLogger("reader")
var skipCoords, skipNodes, skipWays bool
var nParser, nWays, nRels, nNodes, nCoords int64
func init() {
if os.Getenv("IMPOSM_SKIP_COORDS") != "" {
skipCoords = true
}
if os.Getenv("IMPOSM_SKIP_NODES") != "" {
skipNodes = true
}
if os.Getenv("IMPOSM_SKIP_WAYS") != "" {
skipWays = true
}
if procConf := os.Getenv("IMPOSM_READ_PROCS"); procConf != "" {
示例4: goLogString
#include <stdlib.h>
extern void goLogString(char *msg);
extern void debug_wrap(const char *fmt, ...);
extern GEOSContextHandle_t initGEOS_r_debug();
extern void initGEOS_debug();
*/
import "C"
import (
"github.com/omniscale/imposm3/logging"
"runtime"
"unsafe"
)
var log = logging.NewLogger("GEOS")
//export goLogString
func goLogString(msg *C.char) {
log.Printf(C.GoString(msg))
}
type Geos struct {
v C.GEOSContextHandle_t
srid int
}
type Geom struct {
v *C.GEOSGeometry
}
示例5: PrintCmds
import (
"fmt"
golog "log"
"os"
"runtime"
"github.com/omniscale/imposm3/cache/query"
"github.com/omniscale/imposm3/config"
"github.com/omniscale/imposm3/diff"
"github.com/omniscale/imposm3/import_"
"github.com/omniscale/imposm3/logging"
"github.com/omniscale/imposm3/stats"
)
var log = logging.NewLogger("")
func PrintCmds() {
fmt.Fprintf(os.Stderr, "Usage: %s COMMAND [args]\n\n", os.Args[0])
fmt.Println("Available commands:")
fmt.Println("\timport")
fmt.Println("\tdiff")
fmt.Println("\tquery-cache")
fmt.Println("\tversion")
}
func Main(usage func()) {
golog.SetFlags(golog.LstdFlags | golog.Lshortfile)
if os.Getenv("GOMAXPROCS") == "" {
runtime.GOMAXPROCS(runtime.NumCPU())
}
示例6: Update
"github.com/omniscale/imposm3/database"
_ "github.com/omniscale/imposm3/database/postgis"
"github.com/omniscale/imposm3/diff/parser"
diffstate "github.com/omniscale/imposm3/diff/state"
"github.com/omniscale/imposm3/element"
"github.com/omniscale/imposm3/expire"
"github.com/omniscale/imposm3/geom/geos"
"github.com/omniscale/imposm3/geom/limit"
"github.com/omniscale/imposm3/logging"
"github.com/omniscale/imposm3/mapping"
"github.com/omniscale/imposm3/proj"
"github.com/omniscale/imposm3/stats"
"github.com/omniscale/imposm3/writer"
)
var log = logging.NewLogger("diff")
func Update(oscFile string, geometryLimiter *limit.Limiter, expireor expire.Expireor, osmCache *cache.OSMCache, diffCache *cache.DiffCache, force bool) error {
state, err := diffstate.ParseFromOsc(oscFile)
if err != nil {
return err
}
lastState, err := diffstate.ParseLastState(config.BaseOptions.DiffDir)
if err != nil {
log.Warn(err)
}
if lastState != nil && lastState.Sequence != 0 && state != nil && state.Sequence <= lastState.Sequence {
if !force {
log.Warn(state, " already imported")
return nil
示例7:
import (
"runtime"
"sync"
"github.com/omniscale/imposm3/cache"
"github.com/omniscale/imposm3/database"
"github.com/omniscale/imposm3/element"
"github.com/omniscale/imposm3/expire"
"github.com/omniscale/imposm3/geom/limit"
"github.com/omniscale/imposm3/logging"
"github.com/omniscale/imposm3/proj"
"github.com/omniscale/imposm3/stats"
)
var log = logging.NewLogger("writer")
type ErrorLevel interface {
Level() int
}
type looper interface {
loop()
}
type OsmElemWriter struct {
osmCache *cache.OSMCache
diffCache *cache.DiffCache
progress *stats.Statistics
inserter database.Inserter
wg *sync.WaitGroup
示例8: init
package mapping
import (
"errors"
"regexp"
"strconv"
"strings"
"github.com/omniscale/imposm3/element"
"github.com/omniscale/imposm3/logging"
)
var log = logging.NewLogger("mapping")
var AvailableFieldTypes map[string]FieldType
func init() {
AvailableFieldTypes = map[string]FieldType{
"bool": {"bool", "bool", Bool, nil},
"boolint": {"boolint", "int8", BoolInt, nil},
"id": {"id", "int64", Id, nil},
"string": {"string", "string", String, nil},
"direction": {"direction", "int8", Direction, nil},
"integer": {"integer", "int32", Integer, nil},
"mapping_key": {"mapping_key", "string", KeyName, nil},
"mapping_value": {"mapping_value", "string", ValueName, nil},
"geometry": {"geometry", "geometry", Geometry, nil},
"validated_geometry": {"validated_geometry", "validated_geometry", Geometry, nil},
"hstore_tags": {"hstore_tags", "hstore_string", HstoreString, nil},
"wayzorder": {"wayzorder", "int32", WayZOrder, nil},
"pseudoarea": {"pseudoarea", "float32", PseudoArea, nil},
示例9: Parse
package parser
import (
"compress/gzip"
"encoding/xml"
"github.com/omniscale/imposm3/element"
"github.com/omniscale/imposm3/logging"
"os"
"strconv"
)
var log = logging.NewLogger("osc parser")
type DiffElem struct {
Add bool
Mod bool
Del bool
Node *element.Node
Way *element.Way
Rel *element.Relation
}
func Parse(diff string) (chan DiffElem, chan error) {
elems := make(chan DiffElem)
errc := make(chan error)
go parse(diff, elems, errc)
return elems, errc
}
func parse(diff string, elems chan DiffElem, errc chan error) {
defer close(elems)
示例10:
package geojson
import (
"encoding/json"
"errors"
"fmt"
"io"
"github.com/omniscale/imposm3/logging"
)
var log = logging.NewLogger("geojson")
type object struct {
Type string `json:"type"`
Features []object `json:"features"`
Geometry *object `json:"geometry"`
Coordinates []interface{} `json:"coordinates"`
Properties map[string]interface{} `json:"properties"`
}
type geometry struct {
Type string `json:"type"`
Coordinates []interface{} `json:"coordinates"`
}
type Point struct {
Long float64
Lat float64
}