From 7abc7a370d1d063a4b875c3685aaa925d06b7fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Musab=20G=C3=BCltekin?= Date: Sun, 9 Jun 2019 19:14:46 +0300 Subject: [PATCH] Disabling logs support added. --- README.md | 4 +++- geziyor.go | 3 +++ options.go | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cdb0870..ae81630 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Geziyor is a blazing fast web crawling and web scraping framework, used to crawl - Request Delays (Constant/Randomized) - Automatic response decoding to UTF-8 +See scraper [Options](https://godoc.org/github.com/geziyor/geziyor#Options) for customization. ## Usage Simplest usage @@ -53,4 +54,5 @@ geziyor.Start() go get github.com/geziyor/geziyor -We highly recommend you to use go modules. As this project is in **development stage** right now. +## Status +We highly recommend you to use go modules. As this project is in **development stage** right now and **API is not stable**. diff --git a/geziyor.go b/geziyor.go index 8088fad..bbfca45 100644 --- a/geziyor.go +++ b/geziyor.go @@ -62,6 +62,9 @@ func NewGeziyor(opt Options) *Geziyor { if opt.UserAgent == "" { geziyor.opt.UserAgent = "Geziyor 1.0" } + if opt.LogDisabled { + log.SetOutput(ioutil.Discard) + } return geziyor } diff --git a/options.go b/options.go index b51445d..4f3fcf2 100644 --- a/options.go +++ b/options.go @@ -37,4 +37,7 @@ type Options struct { RequestDelay time.Duration // RequestDelayRandomize uses random interval between 0.5 * RequestDelay and 1.5 * RequestDelay RequestDelayRandomize bool + + // Disable logging by setting this true + LogDisabled bool }