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

Inserting into a particular document #17

Open
jorge-lavin opened this issue Feb 13, 2016 · 3 comments
Open

Inserting into a particular document #17

jorge-lavin opened this issue Feb 13, 2016 · 3 comments

Comments

@jorge-lavin
Copy link

Hi

I was wondering about the idea of inserting the log messages into a particular document in a given collection.

In terms of design I see a downfall, it requires explicitly the document id. For instance via dependency injection, but I'm failing to see to do this in a transparent way (disable / enable handler under demand, without modifying the rest of the logging calls)

Kind regards

@oz123
Copy link
Collaborator

oz123 commented Feb 13, 2016

You'll probably have to write your own class that inherits from the main logger class to implement this.
In this class you'll have to change write_method to update_one and pass this pass a custom formatter which does not create a new document every time it is invoked.

If you really need this feature you can contact me privately. I am currently busy with higher prio projects.

@jorge-lavin
Copy link
Author

@oz123 I may work into this, do you have any contribution policy at this moment?

My main concern is where do you specify the Object Id of the document that you want to the message to be inserted in

@oz123
Copy link
Collaborator

oz123 commented Mar 7, 2016

@LavinJ , if you are already inserting a specific Document, you could also overwrite the _id. MongoDB allows that. I outlined more or less how you should do it your feature in my previous comment. As for a policy:
keep your code pep-8 compatible, and make sure you submit tested code - e.g. with tests. If you do this, I see no reason, as long as your code does not break other things, why your PR should no be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants