Skip to content

Commit 4c68997

Browse files
committed
Log for operation.
1 parent 3b05990 commit 4c68997

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

crawler-distributed/main.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"flag"
5+
"log"
56
"polaris/crawler-distributed/config"
67
itemsaver "polaris/crawler-distributed/persist/client"
78
"polaris/crawler-distributed/pool"
@@ -24,6 +25,27 @@ func main() {
2425
// run itemsaver.go first
2526
// then to run worker.go
2627
flag.Parse()
28+
29+
if *itemSaverHost == "" && *workerHosts == "" {
30+
log.Println("Must specify one or more itemsaver host, like this:\n" +
31+
"go run main.go --itemsaver_host=\":9200\"")
32+
log.Println("Must specify one or more worker host, like this:\n" +
33+
"go run main.go --worker_host=\"9300\"")
34+
log.Print("You can typing the go run main.go --help for get help")
35+
return
36+
}
37+
if *itemSaverHost == "" {
38+
log.Print("Must specify one or more itemsaver host, like this:\n" +
39+
"go run main.go --itemsaver_host=\":9200\"")
40+
return
41+
}
42+
43+
if *workerHosts == "" {
44+
log.Print("Must specify one or more worker host, like this:\n" +
45+
"go run main.go --worker_host=\"9300\"")
46+
return
47+
}
48+
2749
itemChan, err := itemsaver.ItemSaver(*itemSaverHost)
2850
if err != nil {
2951
panic(err)

crawler/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ func main() {
2626
parser.ParseCityList,
2727
config.ParseCityList),
2828
})
29+
30+
31+
// unblock the following code, we can got zhenai.com user details.
32+
2933
/*e.Run(engine.Request{
3034
Url: shanghai,
3135
Parser: engine.NewFuncParser(

0 commit comments

Comments
 (0)