# log **Repository Path**: mirrors_kr/log ## Basic Information - **Project Name**: log - **Description**: Conveniently log function duration - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2026-08-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README PACKAGE DOCUMENTATION package timer import "github.com/kr/log/timer" Package timer provides a wrapper for log.Print to measure the duration of a function's execution. It can be used conveniently in conjunction with "defer". The statement defer timer.Start().Print() prints the time elapsed between the call to Start (when the defer statement executes) and the call to Print (when the function returns). It can also be used, without defer, to log elapsed time to more than one point. The sequence t := timer.Start() // time-consuming code t.Print("first part") // more time-consuming code t.Print("total") prints the cumulative time from Start to each Print. Output is formatted with package text/template. All of the good ideas in this package came from @fabiokung, @bmizerany, and @davecheney.