2019-08-17 15:55:25 +03:00
|
|
|
// For more tutorials: https://blog.learngoprogramming.com
|
|
|
|
//
|
|
|
|
// Copyright © 2018 Inanc Gumus
|
|
|
|
// Learn Go Programming Course
|
|
|
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
|
|
//
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-08-26 21:52:47 +03:00
|
|
|
// newGrouper(domainGrouper)
|
2019-08-17 15:55:25 +03:00
|
|
|
|
2019-08-26 14:37:58 +03:00
|
|
|
// s := &chartReport{
|
|
|
|
// title: "visits per domain",
|
|
|
|
// width: 1920,
|
|
|
|
// height: 800,
|
|
|
|
// }
|
|
|
|
|
2019-08-26 21:52:47 +03:00
|
|
|
// pipe, err := fromFile("../logs/log.jsonl")
|
|
|
|
// if err != nil {
|
|
|
|
// log.Fatalln(err)
|
|
|
|
// }
|
|
|
|
|
|
|
|
pipe := newPipeline(
|
|
|
|
newTextLog(os.Stdin),
|
|
|
|
newTextReport(),
|
2019-08-28 12:46:43 +03:00
|
|
|
filterBy(notUsing(domainExtFilter("com", "io"))),
|
2019-08-26 21:52:47 +03:00
|
|
|
groupBy(domainGrouper),
|
|
|
|
)
|
2019-08-17 15:55:25 +03:00
|
|
|
|
2019-08-26 14:37:58 +03:00
|
|
|
if err := pipe.run(); err != nil {
|
2019-08-17 15:55:25 +03:00
|
|
|
log.Fatalln(err)
|
|
|
|
}
|
2019-08-19 20:00:27 +03:00
|
|
|
|
|
|
|
// if err := reportFromFile(os.Args[1]); err != nil {
|
|
|
|
// log.Fatalln(err)
|
|
|
|
// }
|
2019-08-17 15:55:25 +03:00
|
|
|
}
|