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

Console sink class in the docs takes 2 parameters, level and opts but in the Console class code, it only takes one parameter, opts #5

Closed
AnoRebel opened this issue Dec 29, 2022 · 7 comments

Comments

@AnoRebel
Copy link

I'm sorry if I'm missing something, but as I was updating my config to use Lazy instead of Packer, I encountered the error:

E5108: Error executing lua ...nvim/lazy/structlog.nvim/lua/structlog/sinks/console.lua:25: attempt to index local 'opts' (a number value)                                                                
stack traceback:
        ...nvim/lazy/structlog.nvim/lua/structlog/sinks/console.lua:25: in function 'Console'
        [string ":lua"]:1: in main chunk

After some blind debugging, I realized passing the Log level number is what causes it and after further checking is when i found the Console class:

function Console:new(opts)
  opts = opts or {}

  local console = {}

  console.async = opts.async or true -- Line 25
  console.processors = opts.processors or {}
  console.formatter = opts.formatter or KeyValue()

  Console.__index = Console
  setmetatable(console, self)

  return console
end
@Tastyep
Copy link
Owner

Tastyep commented Dec 30, 2022

Hello,

You have used the latest documentation while using the code at version 0.1 (as you should).
For version 0.1, the logging level is passed to the logger, while I later made it configurable for each sink.

You can always check the README for version 0.1 here:
https://github.com/Tastyep/structlog.nvim/blob/v0.1/README.md

Because the documentation is based on the main branch, it is out of sinc with the released version, I understand how it can be confusing and will move the newer changes to a development branch.
I should invest some time to finalize this project and release a proper 1.0. It is always easier to start a project than to finish it ...

I'll leave the issue open as long as you need help.

@AnoRebel
Copy link
Author

Awesome. It's all good. As I read the code, I think I moved it to the Logger too.
Will be waiting for that 1.0 update.
Hahah, I totally understand, no worries, most projets dont really finish..
Thanks for your work.

I'll leave it open too so that you can redirect anyone else with the issue until the fix.

@AnoRebel
Copy link
Author

AnoRebel commented Jan 2, 2023

@Tastyep Is it okay to install and use the develop branch, because I want to use the NvimNotify and I think It's not available in the 0.1 branch.
If yes, its installable by just adding the branch="develop" field to packer or lazy.nvim, right.?

PS: I hope you had a great new year.

@Tastyep
Copy link
Owner

Tastyep commented Jan 2, 2023

You should not. I worked on it yesterday and today and the tests are passing, but the README examples are not updated yet, and the configuration structure has changed a little.

It will be ready this week, but I want to spend some time making nice diagrams for the 1.0 release.
I'll notify you here once I have updated the examples so that you can start using it if you want.

If yes, its installable by just adding the branch="develop" field to packer or lazy.nvim, right.?

Yes, it should work.

Thanks, I hope you had a great new year as well :)

@AnoRebel
Copy link
Author

AnoRebel commented Jan 2, 2023

Awesome, thank you.!

I did, thanks.

@Tastyep
Copy link
Owner

Tastyep commented Jan 8, 2023

Hello,

I released the version 0.2 of structlog 🎉 . The API is quite stable and should stay the same until the 1.0 release.
I saw that the logging part was inspired from lvim, so you might be interested in this for migrating to the version 0.2:
LunarVim/LunarVim#3695

I'll let you close the issue if you don't have any questions.

@AnoRebel
Copy link
Author

AnoRebel commented Jan 8, 2023

Awesome, thanks.
Let me set it up real quick, and if I don't get any issues, I'll close this.

Again, thanks.

@AnoRebel AnoRebel closed this as completed Jan 8, 2023
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