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

question: integration into a plugin #2

Closed
aserowy opened this issue Aug 26, 2021 · 2 comments
Closed

question: integration into a plugin #2

aserowy opened this issue Aug 26, 2021 · 2 comments
Labels
question Further information is requested

Comments

@aserowy
Copy link

aserowy commented Aug 26, 2021

Hi,

i want to integrate your wonderful logging tool as optional dependency into aserowy/tmux.nvim. The point is, i have a REALLY light integration for logging and could define a new channel at https://github.com/aserowy/tmux.nvim/tree/main/lua/tmux/log. Thus, the user must configure it proactively to use your logging implementation.
But it would be cool, to just check if your plugin is present and if so, register the channel automatically. Do you have any idea how i can check if your plugin exists (and is loaded) to register all log calls against it?

Kind regards
Alexander

@Tastyep
Copy link
Owner

Tastyep commented Aug 26, 2021

Hello,

Thank you for your interest and kind words.
I think you could achieve that by checking package.loaded:
if package.loaded["structlog"] then ... end

Now, I'm not sure if I understand correctly what you are trying to achieve. Personally, I would replace your logging implementation with structlog and extend it to your needs by defining new sinks (what you called channel).

If needed, I made a luarocks package.

EDIT: Another idea, you could accept a custom logger when configuring your plugin and fallback to your own implementation (as long as interfaces match)

@Tastyep Tastyep added the question Further information is requested label Aug 26, 2021
@aserowy
Copy link
Author

aserowy commented Aug 26, 2021

ty for the heads up. This is exactly what i need.

To clarify: I do not want to introduce a breaking change to extend logging and force a new plugin (which functionality is not strictly needed for all users) but want to support your (way better and specialized) plugin in an additive way. Thus, somebody (like me in my own config) can introduce your plugin and tmux.nvim will use it if installed.

Kind regards

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

No branches or pull requests

2 participants