From 13565fa5cb2cc6b3fb838ba278f92ecce2fc853c Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Fri, 26 Apr 2024 18:03:48 +0100 Subject: [PATCH] improve the readme and contributing guide (#16) Co-authored-by: Hasan Ramezani --- CONTRIBUTING.md | 2 +- README.md | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b395adf6..889f8cf7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ We'd love anyone interested to contribute to the Logfire SDK and documentation. 1. Fork and clone the repository 2. [Install Rye](https://rye-up.com/guide/basics/) -3. Run `make install` this will install necessary dependencies +3. Run `make install` to install dependencies 4. Run `make test` to run unit tests 5. Run `make format` to format code 6. Run `make lint` to lint code diff --git a/README.md b/README.md index 4220fd57..23c7db06 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,34 @@ -# Logfire — Uncomplicated Observability +# Pydantic Logfire — Uncomplicated Observability [![CI](https://github.com/pydantic/logfire/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/pydantic/logfire/actions?query=event%3Apush+branch%3Amain+workflow%3ACI) [![pypi](https://img.shields.io/pypi/v/logfire.svg)](https://pypi.python.org/pypi/logfire) [![license](https://img.shields.io/github/license/pydantic/logfire.svg)](https://github.com/pydantic/logfire/blob/main/LICENSE) -Logging and more like you always hoped it would be. +Logging like you always hoped it would be. See the [documentation](https://docs.pydantic.dev/logfire/) for more information. -**Feel free to report issues and ask questions about `logfire` in this repository!** +**Feel free to report issues and ask any questions about Logfire in this repository!** This repo contains the Python SDK for `logfire` and documentation, the server application for recording and displaying data is closed source. -## Installation +## Setup +Install: ```bash pip install logfire ``` -[_(learn more)_](https://docs.pydantic.dev/logfire/guides/first_steps/?h=install#install) +[_(learn more)_](https://docs.pydantic.dev/logfire/guides/first_steps/#install) + +Authenticate: +```bash +logfire auth +``` +[_(learn more)_](https://docs.pydantic.dev/logfire/guides/first_steps/#authentication) ## Usage -Very simple logging/tracing example: +Here's a simple manual tracing (aka logging) example: ```python import logfire @@ -36,10 +43,9 @@ with logfire.span('Asking the user their {question}', question='age'): ``` [_(learn more)_](https://docs.pydantic.dev/logfire/guides/onboarding_checklist/03_add_manual_tracing/) -Or you can avoid manual instrumentation and instead integrate with [lots of popular packages](https://github.com/samuelcolvin?tab=repositories), here's an example of integrating with FastAPI: +Or you can also avoid manual instrumentation and instead integrate with [lots of popular packages](https://docs.pydantic.dev/logfire/integrations/), here's an example of integrating with FastAPI: ```py -from datetime import date import logfire from pydantic import BaseModel from fastapi import FastAPI @@ -50,12 +56,9 @@ logfire.configure() logfire.instrument_fastapi(app) # next, instrument your database connector, http library etc. and add the logging handler - class User(BaseModel): name: str country_code: str - dob: date - @app.post('/') async def add_user(user: User): @@ -64,6 +67,10 @@ async def add_user(user: User): ``` [_(learn more)_](https://docs.pydantic.dev/logfire/integrations/fastapi/) +Logfire gives you a view into how your code is running like this: + +![Logfire screenshot](https://docs.pydantic.dev/logfire/images/index/logfire-screenshot-fastapi-200.png) + ## Contributing We'd love anyone interested to contribute to the Logfire SDK and documentation, see the [contributing guide](./CONTRIBUTING.md).