Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use influxdb-client as a python native logging handler that writes to InfluxDB #364

Closed
strom-und-spiele opened this issue Nov 18, 2021 · 6 comments · Fixed by #405
Closed
Labels
enhancement New feature or request
Milestone

Comments

@strom-und-spiele
Copy link
Contributor

✨ Feature request

I'd like to use the influxdb-client with the python native logging module.

⏮️ What happend so far

Four years ago there was an attempt to do this, however this project never really took off and seems to be incompatible with the latest version of influx (v2).

💡 Idea and reasoning

The goal would be to have a class within influxdb-client that can be passed as a handler to logging. To me this seems reasonable as it centralizes logging, freeing the individual modules from "knowing" about influx and allowing to make decisions on how to use the log output depending on the context the module is used.
If I'm missing something, I'd really like to hear about it.

🧑‍🏭 Work

I'd like to make this work for a project at my day job, so I have some resources to make this happen anyway. If you think it makes sense, I'll go the extra mile and integrate it directly into this repo.

@bednar
Copy link
Contributor

bednar commented Nov 18, 2021

Hi @strom-und-spiele,

thanks for using our client.

Every PR is welcome, so feel free to implement this feature and we will be happy to accept its.

Regards

@bednar bednar added the enhancement New feature or request label Nov 18, 2021
@strom-und-spiele
Copy link
Contributor Author

Hi @bednar,

happy to hear this.

I'm not quite sure I understood the code structure right:
I guess I'd put the code inside of /influxdb_client/client/loggingHandler.py exposing a InfluxLoggingHandler through the __init__.py file in said folder. The place for tests and examples is obvious ;)

@bednar
Copy link
Contributor

bednar commented Nov 20, 2021

I guess I'd put the code inside of /influxdb_client/client/loggingHandler.py exposing a InfluxLoggingHandler through the __init__.py file in said folder. The place for tests and examples is obvious ;)

Sounds good.

@ronytesler
Copy link

Do you know when this will be ready? Now the logger writes to the console, I want it to write to a file so I can use code to search for errors.

@strom-und-spiele
Copy link
Contributor Author

Hey,

sorry for bringing this up and not doing anything for so long. As always life and important customers came in the way.

Anyhow; I reserved some time next week to push a (working) first draft.

@bednar
Copy link
Contributor

bednar commented Feb 14, 2022

@strom-und-spiele 👍 awesome news, thanks

@bednar bednar changed the title Use influxdb-client with python native logging Use influxdb-client as a python native logging handler that writes to InfluxDB. Feb 28, 2022
@bednar bednar added this to the 1.27.0 milestone Feb 28, 2022
@bednar bednar changed the title Use influxdb-client as a python native logging handler that writes to InfluxDB. Use influxdb-client as a python native logging handler that writes to InfluxDB Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants