package main
import (
"bufio"
"fmt"
"os"
"psla/p4dlogparse"
"github.com/akamensky/argparse"
"github.com/pkg/profile"
)
type parseResult struct {
buf bufio.Writer
callback p4dlogparse.P4dOutputCallback
}
func newResult() *parseResult {
var pr parseResult
buf := bufio.NewWriterSize(os.Stdout, 1024*1024)
defer buf.Flush()
pr.callback = func(output string) {
fmt.Fprintf(buf, "%s\n", output)
}
return &pr
}
func main() {
// CPU profiling by default
defer profile.Start().Stop()
// Create new parser object
parser := argparse.NewParser("psla", "Perforce Server Log Analyzer - parses standard log file")
// Create string flag
filename := parser.String("f", "file", &argparse.Options{Required: true, Help: "Log file to process"})
// Parse input
if err := parser.Parse(os.Args); err != nil {
fmt.Print(parser.Usage(err))
}
opts := new(p4dlogparse.P4dParseOptions)
opts.File = *filename
presult := newResult()
fp := p4dlogparse.NewP4dFileParser(presult.callback)
fp.P4LogParseFile(*opts)
}
# |
Change |
User |
Description |
Committed |
|
#4
|
24570 |
rcowham |
Improve performance by reducing regexp calls and buffering system calls |
|
|
#3
|
24567 |
rcowham |
Fixed main to use new structure |
|
|
#2
|
24559 |
rcowham |
Handle completedLapse and computeLapse |
|
|
#1
|
24557 |
rcowham |
Initial version - getting somehwere! |
|
|