escpos icon indicating copy to clipboard operation
escpos copied to clipboard

Disable logging by default

Open damdo opened this issue 3 years ago • 0 comments

First of all, thanks for this library. One thing I noticed while using it is that it is quite chatty in that it logs every time it write any bytes to the printer.

Here: https://github.com/kenshaw/escpos/blob/81d0344e35fafe5bda5dc2b6adf43d8abcff36c7/escpos.go#L92

and here: https://github.com/kenshaw/escpos/blob/81d0344e35fafe5bda5dc2b6adf43d8abcff36c7/escpos.go#L95

I think this is quite useful for certain cases but quite noisy for most of the other cases, where this level of logging might not be necessary/needed.

Thus I'd like to propose if we could make the logging optional and have some sort of configuration option to enable it when needed.

Alternatively we could use the int already returned by WriteRaw (which is currently always returning 0), and return the number of bytes that have been written so then the caller can log the result if interested.

How does this sound? Thanks

damdo avatar Aug 21 '22 20:08 damdo