|
| 1 | +# webtail |
| 2 | + |
| 3 | +> websocket 経由で [log] ファイルを Tail する |
| 4 | +
|
| 5 | +<p align="center"> |
| 6 | + <a href="README.md#readme">English</a> | |
| 7 | + <a href="README.ru.md#readme">Pусский</a> | |
| 8 | + <span>日本語</span> |
| 9 | +</p> |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +[![Go Reference][ref1]][ref2] |
| 14 | + [![GitHub Release][gr1]][gr2] |
| 15 | + [![Build Status][bs1]][bs2] |
| 16 | + [![GitHub license][gl1]][gl2] |
| 17 | + |
| 18 | +[![Go Coverage][cc1]][cc2] |
| 19 | + [![Test Coverage][cct1]][cct2] |
| 20 | + [![Maintainability][ccm1]][ccm2] |
| 21 | + [![GoCard][gc1]][gc2] |
| 22 | + |
| 23 | +[cct1]: https://api.codeclimate.com/v1/badges/909eca87d9ee5b216a6b/test_coverage |
| 24 | +[cct2]: https://codeclimate.com/github/LeKovr/webtail/test_coverage |
| 25 | +[ccm1]: https://api.codeclimate.com/v1/badges/909eca87d9ee5b216a6b/maintainability |
| 26 | +[ccm2]: https://codeclimate.com/github/LeKovr/webtail/maintainability |
| 27 | +[ref1]: https://pkg.go.dev/badge/github.com/LeKovr/webtail.svg |
| 28 | +[ref2]: https://pkg.go.dev/github.com/LeKovr/webtail |
| 29 | +[cc1]: https://github.com/LeKovr/webtail/wiki/coverage.svg |
| 30 | +[cc2]: https://raw.githack.com/wiki/LeKovr/webtail/coverage.html |
| 31 | +[gc1]: https://goreportcard.com/badge/github.com/LeKovr/webtail |
| 32 | +[gc2]: https://goreportcard.com/report/github.com/LeKovr/webtail |
| 33 | +[bs1]: https://github.com/LeKovr/webtail/actions/workflows/docker-publish.yml/badge.svg |
| 34 | +[bs2]: http://github.com/LeKovr/webtail/actions/workflows/docker-publish.yml |
| 35 | +[gr1]: https://img.shields.io/github/release/LeKovr/webtail.svg |
| 36 | +[gr2]: https://github.com/LeKovr/webtail/releases |
| 37 | +[gl1]: https://img.shields.io/github/license/LeKovr/webtail.svg |
| 38 | +[gl2]: https://github.com/LeKovr/webtail/blob/master/LICENSE |
| 39 | + |
| 40 | +[webtail](https://github.com/LeKovr/webtail) はウェブサービスと golang パッケージで、websocker 経由で継続的に更新されたファイルをブラウザに公開するために使われます。 |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## インストール |
| 45 | + |
| 46 | +```sh |
| 47 | +go get -v github.com/LeKovr/webtail/... |
| 48 | +``` |
| 49 | + |
| 50 | +### ダウンロード バイナリ |
| 51 | + |
| 52 | +[最新リリース](https://github.com/LeKovr/webtail/releases/latest)を参照 |
| 53 | + |
| 54 | +### Docker |
| 55 | + |
| 56 | +0.43.2 以降の docker イメージは、[GitHub Packages](https://ghcr.io) で公開されています |
| 57 | + |
| 58 | +```sh |
| 59 | +docker pull ghcr.io/lekovr/webtail:latest |
| 60 | +``` |
| 61 | + |
| 62 | +使用例は [docker-compose.yml](docker-compose.yml) を参照。 |
| 63 | + |
| 64 | +v0.43.1 は [dockerhub で利用可能な最後のバージョン](https://hub.docker.com/repository/docker/lekovr/webtail/tags)です。 |
| 65 | + |
| 66 | +## サービスでパッケージを使用する |
| 67 | + |
| 68 | +```go |
| 69 | +package main |
| 70 | +import ( |
| 71 | + "github.com/LeKovr/webtail" |
| 72 | +) |
| 73 | + |
| 74 | +func main() { |
| 75 | + wt, err := webtail.New(log, cfg) |
| 76 | + if err != nil { |
| 77 | + return |
| 78 | + } |
| 79 | + go wt.Run() |
| 80 | + defer wt.Close() |
| 81 | + // ... |
| 82 | + http.Handle("/tail", wt) |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +こちらも参照: [app.go](https://github.com/LeKovr/webtail/blob/master/cmd/webtail/app.go) |
| 87 | + |
| 88 | +## gorilla/websocket に関する注意事項 |
| 89 | + |
| 90 | +v0.30 から、このコードは [gorilla/websocket チャット例](https://github.com/gorilla/websocket/tree/master/examples/chat)に基づいています。{client,hub}.go を参照 |
| 91 | + |
| 92 | +## ライセンス |
| 93 | + |
| 94 | +MIT ライセンス (MIT)、[LICENSE](LICENSE) を参照のこと。 |
| 95 | + |
| 96 | +Copyright (c) 2016-2021 Aleksey Kovrizhkin <[email protected]> |
0 commit comments