Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configurable error level handling and custom loggers #20

Merged
merged 8 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
conversion done
  • Loading branch information
tbonfort committed May 28, 2021
commit 5c09e7d40c35b79d2dc7df45a36a6950161c6ac4
4 changes: 2 additions & 2 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func Drivers(drivers ...string) interface {
} {
return driversOpt{drivers}
}
func (do driversOpt) setOpenOption(oo *openOptions) {
func (do driversOpt) setOpenOpt(oo *openOpts) {
oo.drivers = append(oo.drivers, do.drivers...)
}

Expand All @@ -130,7 +130,7 @@ func DriverOpenOption(keyval ...string) interface {
} {
return driverOpenOption{keyval}
}
func (doo driverOpenOption) setOpenOption(oo *openOptions) {
func (doo driverOpenOption) setOpenOpt(oo *openOpts) {
oo.options = append(oo.options, doo.oo...)
}
func (doo driverOpenOption) setBuildVRTOpt(bvo *buildVRTOpts) {
Expand Down
193 changes: 192 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,206 @@ type errorAndLoggingOption interface {

func ErrLogger(fn ErrorHandler) interface {
errorAndLoggingOption
BandCreateMaskOption
BandIOOption
//BoundsOption
BufferOption
BuildOverviewsOption
BuildVRTOption
ClearOverviewsOption
CloseOption
CreateLayerOption
CreateSpatialRefOption
DatasetCreateMaskOption
DatasetCreateOption
DatasetIOOption
DatasetTranslateOption
DatasetVectorTranslateOption
DatasetWarpIntoOption
DatasetWarpOption
DeleteFeatureOption
FeatureCountOption
FillBandOption
GeoJSONOption
GeometryTransformOption
GeometryReprojectOption
GeometryWKBOption
GeometryWKTOption
GetGeoTransformOption
HistogramOption
MetadataOption
NewFeatureOption
NewGeometryOption
OpenOption
PolygonizeOption
RasterizeGeometryOption
RasterizeOption
SetColorInterpOption
SetColorTableOption
SetGeometryOption
SetNoDataOption
SetGeoTransformOption
SetProjectionOption
SetSpatialRefOption
SimplifyOption
TransformOption
UpdateFeatureOption
VSIHandlerOption
VSIOpenOption
VSIUnlinkOption
WKTExportOption
} {
return errorCallback{fn}
}

func (ec errorCallback) setErrorAndLoggingOpt(elo *errorAndLoggingOpts) {
elo.eh = ec.fn
}
func (ec errorCallback) setBandCreateMaskOpt(o *bandCreateMaskOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setBandIOOpt(o *bandIOOpts) {
o.errorHandler = ec.fn
}

/*
func (ec errorCallback) setBoundsOpt(o *boundsOpts) {
o.errorHandler = ec.fn
}
*/
func (ec errorCallback) setBufferOpt(o *bufferOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setBuildOverviewsOpt(o *buildOvrOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setBuildVRTOpt(o *buildVRTOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setClearOverviewsOpt(o *clearOvrOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setCloseOpt(o *closeOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setCreateLayerOpt(o *createLayerOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setCreateSpatialRefOpt(o *createSpatialRefOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetCreateMaskOpt(o *dsCreateMaskOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetCreateOpt(o *dsCreateOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetIOOpt(o *datasetIOOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetTranslateOpt(o *dsTranslateOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetVectorTranslateOpt(o *dsVectorTranslateOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetWarpIntoOpt(o *dsWarpIntoOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDatasetWarpOpt(o *dsWarpOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDeleteFeatureOpt(o *deleteFeatureOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setFeatureCountOpt(o *featureCountOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setFillBandOpt(o *fillBandOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setGeojsonOpt(o *geojsonOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setGeometryTransformOpt(o *geometryTransformOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setGeometryReprojectOpt(o *geometryReprojectOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setGeometryWKBOpt(o *geometryWKBOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setGeometryWKTOpt(o *geometryWKTOpts) {
o.errorHandler = ec.fn
}

func (ec errorCallback) setOpenOption(oo *openOptions) {
func (ec errorCallback) setGetGeoTransformOpt(o *getGeoTransformOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setHistogramOpt(o *histogramOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setMetadataOpt(o *metadataOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setNewFeatureOpt(o *newFeatureOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setNewGeometryOpt(o *newGeometryOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setOpenOpt(oo *openOpts) {
oo.errorHandler = ec.fn
}
func (ec errorCallback) setPolygonizeOpt(o *polygonizeOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setRasterizeGeometryOpt(o *rasterizeGeometryOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setRasterizeOpt(o *rasterizeOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setSetColorInterpOpt(ndo *setColorInterpOpts) {
ndo.errorHandler = ec.fn
}
func (ec errorCallback) setSetColorTableOpt(ndo *setColorTableOpts) {
ndo.errorHandler = ec.fn
}
func (ec errorCallback) setSetGeometryOpt(o *setGeometryOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setSetGeoTransformOpt(o *setGeoTransformOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setSetProjectionOpt(o *setProjectionOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setSetNoDataOpt(ndo *setNodataOpts) {
ndo.errorHandler = ec.fn
}
func (ec errorCallback) setSetSpatialRefOpt(ndo *setSpatialRefOpts) {
ndo.errorHandler = ec.fn
}
func (ec errorCallback) setSimplifyOpt(o *simplifyOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setTransformOpt(o *trnOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setUpdateFeatureOpt(o *updateFeatureOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setVSIHandlerOpt(o *vsiHandlerOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setVSIOpenOpt(o *vsiOpenOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setVSIUnlinkOpt(o *vsiUnlinkOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setWKTExportOpt(o *srWKTOpts) {
o.errorHandler = ec.fn
}
Loading