GithubHelp home page GithubHelp logo

gyozatech / noodlog Goto Github PK

View Code? Open in Web Editor NEW
44.0 6.0 9.0 454 KB

๐Ÿœ Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.

License: Apache License 2.0

Go 99.75% Makefile 0.25%
golang-library golang golang-tool logging-library logging go json password-safety hacktoberfest hacktoberfest2021

noodlog's People

Contributors

alessandroargentieri avatar amoghrajesh avatar davideimola avatar ilmanzo avatar marcosansoni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

noodlog's Issues

Add badges to readme

We want to have badges in the README.md file through the github actions.
Some interesting badges could be:

  • build
  • test coverage
  • static code analysis analysis

Color enhancements

User Story

As a developer, I would like to make some enhancements to Colors.

Detailed Description

The proposed enhancements are as follows:

  • move Color struct and its methods to log_struct.go file where all the structs of the library are contained. (Even if it's very contextual to have it in color.go file)
  • if Color struct and its attribute Code are only reachable from the internal of the noodlog package, change to lowercase letters (color, code). If only Code can be private, it would be the only one to be changed lowercase.
  • if we can use a default code color, change the color.code from pointer to string. This way we can avoid using the function ToCode() in order to get its string value, but we can access directly with color.code instead of color.ToCode(). If it's not possible to remove the pointer and to delete ToCode() function, evaluate if it's possible to use lowercase toCode().

Enable Datetime format customization

User Story

As an operator, I would like to get a DateTime formatted according to my needs.

Detailed Description

Maintain the present formatting as default and allow user customization in order to vary the format, consider the timezone too.

Refactor logger as struct

User Story

As a user, I would like to create an instance of my logger to prevent using a global set of functions.

Detailed Description

By having a logger with a set of global functions and settings we can have concurrency issues, mostly in tests.

Create a struct Logger and move all the configs and behaviors on this object.
Also, tests and documentation must be updated after this deep refactor.

extract ObscureSensitiveParams function

Now you can enable or disable the ObscureSensitiveData functionality whose check is applied to all log records when enabled.
It slows down the execution time even when you log a simple record.
Extract and make ObscureSensitiveParam public, in order to give the possibility to choose to disable the functionality and using it only when needed.
This could be done this way:

log.SetConfig{ &log.Configs{
         ObscureSensitiveData: log.Disable,
         SensitiveParams: []string{"password"},
     }
}

And then:

log.Info(log.ObscureSensitiveData(myrecord))

This way the feature remains disabled by default but used only when needed.

Extend sensitive data obfuscation

The regex used to obfuscate sensitive data nowadays works only on string parameters.
Extend the regex or add a new regex in order to get also data without double-quotes.
In that case, try to figure out if null is a better value for boolean, numbers in place of "**************" used for strings.

Create Benchmark

User Story

As a developer, I would like to have a benchmark for noodlog performances.

Detailed Description

It's also possible to compare noodlog with logrus, because it solves similar problems and has similar performances.

Anything else

Keep in mind that enabling sensitive data obscuration, colors, pretty printing is more cost computational than not using these confs.

Keep also in mind that printing a JSON or an Object is more cost computational that writing a simple string record.

Add the Code Coverage

User Story

As a developer, I would like to have code coverage for this project.

Detailed Description

Adds codecov for this project.

Logs don't go new line

Bug description

The log messages don't go to next line.

How to reproduce

Just check the logged messages

Environment

  • Go version 16+
  • OS and Architecture: any

Anything else

Hint: change the fmt.Fprintf() function into fmt.Fprintln() into logger.go -> printLog function.

Test TestSimpleLogger is flaky

Bug description

The test TestSimpleLogger is a bit flaky. We must resolve the flakiness.

How to reproduce

Run the tests without cache and you can see the test can go both green and red.

Include examples of "out of the box" logs format in the README

Currently, in the README is possible to see an example of a colorized pretty-printed output.
This is very cool, although it would be useful for someone stumbling upon this library knowing what's the default behavior without any of the configured parameters.

Sometimes it's useful to print everything on a single line and let the use possibly format the output, and some people would look for that specific feature first

Good stuff! ๐Ÿ‘

Add the possibility to print log in files

User Story

As a developer, I would like to have the possibility to choose to redirect all logs in a file (one file for the day) in place of standard output.

Detailed Description
Add a setting to define filename, log rotation, etc. and switch the logic when needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.