From 7ee6baa33ea57efc4905bfe213872ba9732a7553 Mon Sep 17 00:00:00 2001 From: Anton Egorov Date: Mon, 11 Nov 2013 11:20:21 +0300 Subject: [PATCH] mark readme code snippets as a golang code --- README.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dac1888..1af9796 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,27 @@ The library provides `Reader` type and two constructors for it. Common constructor `NewReader` gets opened file (`io.Reader`) and log format (`string`) as argumets. format is in form os nginx `log_format` string. - reader := gonx.NewReader(file, format) +```go +reader := gonx.NewReader(file, format) +``` `NewNginxReader` provides mo magic. It gets nginx config file (`io.Reader`) as second argument and `log_format` name (`string`) a third. - reader := gonx.NewNginxReader(file, nginxConfig, format_name) +```go +reader := gonx.NewNginxReader(file, nginxConfig, format_name) +``` `Reader` implements `io.Reader`. Here is example usage - for { - rec, err := reader.Read() - if err == io.EOF { - break - } - // Process the record... e.g. +```go +for { + rec, err := reader.Read() + if err == io.EOF { + break } + // Process the record... e.g. +} +``` See more examples in `example/*.go` sources. @@ -48,4 +54,4 @@ This library API and internal representation can be changed at any moment, but I ## Contributing -Fork the repo, create a feature branch then send me pull request. Feel free to create new issues or contact me using email. \ No newline at end of file +Fork the repo, create a feature branch then send me pull request. Feel free to create new issues or contact me using email.