Commit graph

5 commits

Author SHA1 Message Date
Tao Jiang
86cc5a1a64 Update the libray reference path to new repo
Signed-off-by: Tao Jiang <taoj@vmware.com>
2021-12-21 13:49:47 -06:00
Máté Lang
18546df781 Added RS Zerolog logging adapter (#96)
* Added RS Zerolog logging adapter

Signed-off-by: Mate Lang <mate.lang@welthee.com>

* Fixed pull request review comments

Signed-off-by: Mate Lang <mate.lang@welthee.com>
2021-12-20 21:21:15 -06:00
Mike Pye
10d6b28edf Use FieldLogger interface to represent logrus logger (#75)
The FieldLogger interface is satisfied by either *Logger or *Entry.
Accepting this interface in place of the concrete *Logger type allows
users to inject a logger with some fields already set. For example, the
application developer might want all logging from the library to have a
`subsystem=kcl` field.

Signed-off-by: Mike Pye <mail@mdpye.co.uk>
2021-12-20 21:21:15 -06:00
Aurélien Rainone
8a8f9e6339 logger: move zap into its own package (#47)
Since #27 vmware-go-kcl has support the any logger interface,
which is very nice.

However due to the fact that `logger/zap.go` directly imports zap.
zap became a dependency of whoever uses `vmware-go-kcl.` The
problem is that zap also has many dependencies.

In order to avoid KCL users to pay a cost for a feature they don't
need, the zap stuff has been moved to a `logger/zap` sub-package.

Fixes #45

Signed-off-by: Aurélien Rainone <aurelien.rainone@gmail.com>
2021-12-20 21:21:15 -06:00
Tao Jiang
0d91fbd443 Add generic logger support (#43)
* Add generic logger support

The current KCL has tight coupling with logrus and it causes
issue for customer to use different logging system such as zap log.
The issue has been opened via:
https://github.com/vmware/vmware-go-kcl/issues/27

This change is to created a logger interface be able to abstract
above logrus and zap log. It makes easy to add support for other
logging system in the fugure. The work is based on:
https://www.mountedthoughts.com/golang-logger-interface/

Some updates are made in order to make logging system easily
injectable and add more unit tests.

Tested against real kinesis and dyamodb as well.

Signed-off-by: Tao Jiang <taoj@vmware.com>

* Add lumberjack configuration options to have fine grained control

Update the file log configuratio by adding most of luberjack
configuration to avoid hardcode default value. Let user to specify
the value because log retention and rotation are very important
for prod environment.

Signed-off-by: Tao Jiang <taoj@vmware.com>
2021-12-20 21:21:14 -06:00