asticode / go-astits

Demux and mux MPEG Transport Streams (.ts) natively in GO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logging

d1mn opened this issue · comments

commented

Hello, I am getting strange descriptors in https://github.com/asticode/go-astits/blob/master/descriptor.go#L1239 in my stream and your package spam messages from https://github.com/asticode/go-astits/blob/master/descriptor.go#L1398.
Can we refactor message logging in one of the following ways:

  • pass an instance of the logger (interface) and log in to it. There is a disadvantage that several pure functions will have one more logger argument.
  • do not log this message at all, then, however, we will lose this information

What do you think about it?

P.S. I can create pull request, if you agree with me)

@kravtsov-dima you're right, those log messages have always been a problem to me in this lib. But injecting a logger in pure functions feels weird as well.

Right now I've added a global logger that needs to be set to see those log messages. That should fix your problem.

I've created a v1.5.0 tag

commented

Thank you very much! This is a great solution for us :)

FYI after giving this change some thought, I've decided to choose another path : the lib will stop logging unknown descriptors or other elements. Instead I've created Unknown types which will allow those who are interested in parsing them to do so.

I've created a v1.6.0 tag.

Could confirm this is working properly in your case?

commented

Yes, it's even better, thank you