# Logs Provides a helper to tail the Kubernetes deployment logs. Usage looks like: ```golang tailer, done := logs.Logger{ Deployment: "mydeployment", Namespace: "mynamespace", }.Start() defer func() { err := done() // closes the tailer if err != nil { ... } }() for line := range tailer.NextLine() { // Do something } ``` ## Features - Tail logs from Kubernetes deployments - Supports in-cluster and out-of-cluster configurations - Automatic pod and container discovery - Configurable timeout - Support for tailing specific number of lines ## Usage ### Basic Usage ```golang tailer, done := logs.Logger{ Deployment: "mydeployment", Namespace: "mynamespace", }.Start() defer func() { err := done() if err != nil { // handle error } }() for line := range tailer.NextLine() { fmt.Println(line) } ``` ### Advanced Usage ```golang // Tail from a specific pod and container tailer, done := logs.Logger{ Deployment: "mydeployment", Namespace: "mynamespace", Pod: "mydeployment-7b5b5c8c9d-xyz12", Container: "mycontainer", TailLines: int64Ptr(100), // Tail last 100 lines Timeout: 5 * time.Minute, }.Start() defer func() { err := done() if err != nil { // handle error } }() for line := range tailer.NextLine() { fmt.Println(line) } ``` ### Helper Functions ```golang // Helper to create a pointer to int64 func int64Ptr(i int64) *int64 { return &i } ``` ## Configuration The Logger struct accepts the following fields: - `Deployment` (required): Name of the Kubernetes deployment - `Namespace` (required): Kubernetes namespace - `Pod` (optional): Specific pod name to tail logs from - `Container` (optional): Specific container name to tail logs from - `TailLines` (optional): Number of lines to tail from the end of logs - `Timeout` (optional): Time to wait before giving up on tailing ## Requirements - Kubernetes cluster access (in-cluster or via kubeconfig) - Proper RBAC permissions to read pod logs