Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 1.6% on proxy.golang.org
Top 1.4% dependent packages on proxy.golang.org
Top 1.5% dependent repos on proxy.golang.org
Top 2.2% forks on proxy.golang.org
Top 1.1% docker downloads on proxy.golang.org

proxy.golang.org : github.com/inconshreveable/log15/v3

Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable. It is modeled after the standard library's io and net/http packages. This package enforces you to only log key/value pairs. Keys must be strings. Values may be any type that you like. The default output format is logfmt, but you may also choose to use JSON instead if that suits you. Here's how you log: This will output a line that looks like: To get started, you'll want to import the library: Now you're ready to start logging: Because recording a human-meaningful message is common and good practice, the first argument to every logging method is the value to the *implicit* key 'msg'. Additionally, the level you choose for a message will be automatically added with the key 'lvl', and so will the current timestamp with key 't'. You may supply any additional context as a set of key/value pairs to the logging function. log15 allows you to favor terseness, ordering, and speed over safety. This is a reasonable tradeoff for logging functions. You don't need to explicitly state keys/values, log15 understands that they alternate in the variadic argument list: If you really do favor your type-safety, you may choose to pass a log.Ctx instead: Frequently, you want to add context to a logger so that you can track actions associated with it. An http request is a good example. You can easily create new loggers that have context that is automatically included with each log line: This will output a log line that includes the path context that is attached to the logger: The Handler interface defines where log lines are printed to and how they are formated. Handler is a single interface that is inspired by net/http's handler interface: Handlers can filter records, format them, or dispatch to multiple other Handlers. This package implements a number of Handlers for common logging patterns that are easily composed to create flexible, custom logging structures. Here's an example handler that prints logfmt output to Stdout: Here's an example handler that defers to two other handlers. One handler only prints records from the rpc package in logfmt to standard out. The other prints records at Error level or above in JSON formatted output to the file /var/log/service.json This package implements three Handlers that add debugging information to the context, CallerFileHandler, CallerFuncHandler and CallerStackHandler. Here's an example that adds the source file and line number of each logging call to the context. This will output a line that looks like: Here's an example that logs the call stack rather than just the call site. This will output a line that looks like: The "%+v" format instructs the handler to include the path of the source file relative to the compile time GOPATH. The github.com/go-stack/stack package documents the full list of formatting verbs and modifiers available. The Handler interface is so simple that it's also trivial to write your own. Let's create an example handler which tries to write to one handler, but if that fails it falls back to writing to another handler and includes the error that it encountered when trying to write to the primary. This might be useful when trying to log over a network socket, but if that fails you want to log those records to a file on disk. This pattern is so useful that a generic version that handles an arbitrary number of Handlers is included as part of this library called FailoverHandler. Sometimes, you want to log values that are extremely expensive to compute, but you don't want to pay the price of computing them if you haven't turned up your logging level to a high level of detail. This package provides a simple type to annotate a logging operation that you want to be evaluated lazily, just when it is about to be logged, so that it would not be evaluated if an upstream Handler filters it out. Just wrap any function which takes no arguments with the log.Lazy type. For example: If this message is not logged for any reason (like logging at the Error level), then factorRSAKey is never evaluated. The same log.Lazy mechanism can be used to attach context to a logger which you want to be evaluated when the message is logged, but not when the logger is created. For example, let's imagine a game where you have Player objects: You always want to log a player's name and whether they're alive or dead, so when you create the player object, you might do: Only now, even after a player has died, the logger will still report they are alive because the logging context is evaluated when the logger was created. By using the Lazy wrapper, we can defer the evaluation of whether the player is alive or not to each log message, so that the log records will reflect the player's current state no matter when the log message is written: If log15 detects that stdout is a terminal, it will configure the default handler for it (which is log.StdoutHandler) to use TerminalFormat. This format logs records nicely for your terminal, including color-coded output based on log level. Becasuse log15 allows you to step around the type system, there are a few ways you can specify invalid arguments to the logging functions. You could, for example, wrap something that is not a zero-argument function with log.Lazy or pass a context key that is not a string. Since logging libraries are typically the mechanism by which errors are reported, it would be onerous for the logging functions to return errors. Instead, log15 handles errors by making these guarantees to you: - Any log record containing an error will still be printed with the error explained to you as part of the log record. - Any log record containing an error will include the context key LOG15_ERROR, enabling you to easily (and if you like, automatically) detect if any of your logging calls are passing bad values. Understanding this, you might wonder why the Handler interface can return an error value in its Log method. Handlers are encouraged to return errors only if they fail to write their log records out to an external source like if the syslog daemon is not responding. This allows the construction of useful handlers which cope with those failures like the FailoverHandler. log15 is intended to be useful for library authors as a way to provide configurable logging to users of their library. Best practice for use in a library is to always disable all output for your logger by default and to provide a public Logger instance that consumers of your library can configure. Like so: Users of your library may then enable it if they like: The ability to attach context to a logger is a powerful one. Where should you do it and why? I favor embedding a Logger directly into any persistent object in my application and adding unique, tracing context keys to it. For instance, imagine I am writing a web browser: When a new tab is created, I assign a logger to it with the url of the tab as context so it can easily be traced through the logs. Now, whenever we perform any operation with the tab, we'll log with its embedded logger and it will include the tab title automatically: There's only one problem. What if the tab url changes? We could use log.Lazy to make sure the current url is always written, but that would mean that we couldn't trace a tab's full lifetime through our logs after the user navigate to a new URL. Instead, think about what values to attach to your loggers the same way you think about what to use as a key in a SQL database schema. If it's possible to use a natural key that is unique for the lifetime of the object, do so. But otherwise, log15's ext package has a handy RandId function to let you generate what you might call "surrogate keys" They're just random hex identifiers to use for tracing. Back to our Tab example, we would prefer to set up our Logger like so: Now we'll have a unique traceable identifier even across loading new urls, but we'll still be able to see the tab's current url in the log messages. For all Handler functions which can return an error, there is a version of that function which will return no error but panics on failure. They are all available on the Must object. For example: All of the following excellent projects inspired the design of this library: code.google.com/p/log4go github.com/op/go-logging github.com/technoweenie/grohl github.com/Sirupsen/logrus github.com/kr/logfmt github.com/spacemonkeygo/spacelog golang's stdlib, notably io and net/http https://xkcd.com/927/

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/inconshreveable/log15/v3
License: Apache-2.0
Latest release: over 1 year ago
First release: over 1 year ago
Namespace: github.com/inconshreveable/log15
Dependent packages: 30
Dependent repositories: 13
Stars: 1,082 on GitHub
Forks: 151 on GitHub
Docker dependents: 37
Docker downloads: 124,463
See more repository details: repos.ecosyste.ms
Last synced: 9 days ago

github.com/fimreal/rack v0.5.10
练习使用 gin 做的简易工具,方便跨系统时进行文件处理操作
23 versions - Latest release: 13 days ago - 4 dependent packages - 1 dependent repositories - 0 stars on GitHub
Top 8.2% on proxy.golang.org
github.com/mymmrac/go-telegram-bot-api v0.29.2
74 versions - Latest release: about 1 month ago
Top 2.9% on proxy.golang.org
github.com/mymmrac/telego v0.29.2 💰
Package telego provides one-to-one Telegram Bot API method & types. Telego features all methods ...
74 versions - Latest release: about 1 month ago - 18 dependent packages - 16 dependent repositories - 165 stars on GitHub
Top 7.2% on proxy.golang.org
github.com/ngrok/libngrok-go v1.9.1
17 versions - Latest release: 2 months ago - 1 dependent repositories
Top 6.0% on proxy.golang.org
github.com/ngrok/ngrok-go v1.9.1
Embed ngrok secure ingress into your Go apps as a net.Listener with a single line of code.
17 versions - Latest release: 2 months ago - 1 dependent package - 367 stars on GitHub
Top 6.3% on proxy.golang.org
github.com/synapsecns/sanguine/core v0.1.7
Package core contains the core dependencies
90 versions - Latest release: 4 months ago - 12 dependent packages - 1 dependent repositories - 10 stars on GitHub
Top 6.1% on proxy.golang.org
github.com/kubefirst/kubefirst v0.0.0-20240123193949-586e723a783c
Copyright (C) 2021-2023, Kubefirst This program is licensed under MIT. See the LICENSE file for ...
205 versions - Latest release: 4 months ago - 640 stars on GitHub
Top 5.7% on proxy.golang.org
golang.ngrok.com/ngrok/log/log15 v0.0.0-20240122211928-ed503852430b
Embed ngrok secure ingress into your Go apps as a net.Listener with a single line of code.
35 versions - Latest release: 4 months ago - 367 stars on GitHub
Top 8.5% on proxy.golang.org
github.com/ngrok/kubernetes-ingress-controller v0.0.0-20240116173325-852b6428e967
24 versions - Latest release: 4 months ago
Top 5.3% on proxy.golang.org
github.com/itzg/mc-router v0.0.0-20231225141854-ac3e315a1fc3 💰
Routes Minecraft client connections to backend servers based upon the requested server address
27 versions - Latest release: 5 months ago - 328 stars on GitHub
Top 8.2% on proxy.golang.org
github.com/go-enjin/website-thisip-fyi v0.0.0-20231216220641-3d1814dc790c
thisip.fyi
21 versions - Latest release: 5 months ago - 0 stars on GitHub
github.com/go-enjin/be v0.5.6
The Enjin behind Go-Enjin
77 versions - Latest release: 5 months ago - 11 dependent packages - 5 dependent repositories - 0 stars on GitHub
Top 2.2% on proxy.golang.org
golang.ngrok.com/ngrok v1.7.0
Embed ngrok secure ingress into your Go apps as a net.Listener with a single line of code.
20 versions - Latest release: 5 months ago - 28 dependent packages - 13 dependent repositories - 367 stars on GitHub
github.com/hvuhsg/goapi v0.0.0-20231019172415-0de1e0134451
GoAPI - A Fast and Easy-to-use Web Framework for Building APIs in Go
2 versions - Latest release: 7 months ago - 3 stars on GitHub
github.com/zuruuh/caddy-ngrok-listener v0.0.0-20231011121452-919b707bb8b2 removed
Caddy listener_wrapper to automatically listen on an ngrok tunnel
1 version - Latest release: 7 months ago - 0 stars on GitHub
Top 7.1% on proxy.golang.org
github.com/mohammed90/caddy-ngrok-listener v0.1.2
Caddy listener_wrapper to automatically listen on an ngrok tunnel
3 versions - Latest release: 8 months ago - 13 stars on GitHub
github.com/trendev/ngrok-file-server v1.1.0
fast as lightning, secure tiny file server, based on ngrok and golang
8 versions - Latest release: 8 months ago - 0 stars on GitHub
github.com/marksalpeter/go-qstash v0.0.0-20230826203922-2b75b536d235
Package qstash is a go library for the (QStash) https://upstash.com/docs/qstash/overall/getstarte...
1 version - Latest release: 9 months ago - 2 stars on GitHub
Top 7.5% on proxy.golang.org
github.com/bots-garden/capsule/capsule-http v0.0.0-20230811070628-fd84699bdcbe
Package main, the next generation of the Capsule project
1 version - Latest release: 9 months ago - 282 stars on GitHub
Top 8.5% on proxy.golang.org
github.com/iamelevich/pocketbase-plugin-ngrok v0.13.10
Plugin for Pocketbase that allow you expose it with ngrok
7 versions - Latest release: 10 months ago - 0 stars on GitHub
Top 9.7% on proxy.golang.org
gitlab.com/dk-group-proyects/nghfs v0.0.0-20230725185745-c15384f416fe
1 version - Latest release: 10 months ago
github.com/aidanthewiz/dotserve v0.0.0-20230723202529-4b34f871588d
Effortless hosting of a secure, password-protected HTTP file browser with optional ngrok support.
2 versions - Latest release: 10 months ago - 0 stars on GitHub
github.com/uri/fileserver v0.0.0-20230614003333-e4994d06ab50
A simple fileserver for sharing on your local network on on the internet using ngrok.
2 versions - Latest release: 11 months ago - 1 stars on GitHub
Top 8.2% on proxy.golang.org
github.com/microsoft/commercial-marketplace-offer-deploy v1.3.6
Deployment Manager for the Azure Marketplace
93 versions - Latest release: 11 months ago - 4 stars on GitHub
Top 6.6% on proxy.golang.org
github.com/airplanedev/cli v0.3.201
The Airplane CLI
345 versions - Latest release: 12 months ago - 1 dependent package - 18 stars on GitHub
github.com/rack-plugins/chatgpt v0.0.0-20230523080152-4a69026adc55
chatgpt api
1 version - Latest release: 12 months ago - 1 dependent package - 0 stars on GitHub
Top 9.4% on proxy.golang.org
github.com/microsoft/commercial-marketplace-offer-deploy/tools v0.2.3
Deployment Manager for the Azure Marketplace
5 versions - Latest release: about 1 year ago - 7 stars on GitHub
Top 8.6% on proxy.golang.org
github.com/knightpp/alias-server v0.0.0-20230430164144-3e4fb85f7341
12 versions - Latest release: about 1 year ago - 0 stars on GitHub
Top 9.0% on proxy.golang.org
github.com/auvn/go-ngrok-filehost v0.0.2
2 versions - Latest release: about 1 year ago - 0 stars on GitHub
Top 7.4% on proxy.golang.org
github.com/inconshreveable/olive/v2 v2.0.0-20221207212301-9542b1665553
olive is a a tiny framework built on top of martini for rapid development of robust REST APIs. o...
1 version - Latest release: over 1 year ago - 9 stars on GitHub