Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@utoni
Copy link
Collaborator

@utoni utoni commented May 11, 2023

  • logging is instead redirected to ndpi_debug_printf

@utoni utoni force-pushed the improved/logging_callback_ndpi_printf branch from e72f1a5 to 3636d9b Compare May 12, 2023 10:48
@utoni utoni mentioned this pull request May 15, 2023
1 task
@utoni utoni force-pushed the improved/logging_callback_ndpi_printf branch 23 times, most recently from c97ff11 to 9552a47 Compare May 21, 2023 11:37
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@utoni utoni force-pushed the improved/logging_callback_ndpi_printf branch 3 times, most recently from 03b406a to ef3e510 Compare August 1, 2023 07:38
@utoni utoni marked this pull request as ready for review August 1, 2023 07:39
@utoni utoni requested a review from IvanNardi August 1, 2023 07:39
@utoni utoni force-pushed the improved/logging_callback_ndpi_printf branch 4 times, most recently from 58150d0 to 33c496a Compare August 5, 2023 13:58
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@utoni
Copy link
Collaborator Author

utoni commented Aug 5, 2023

I've decided to use a similar approach as syslog does. Do do that, I've introduced a logging facility which allows the logging callback to distinguish between different nDPI components.

What's your opinion on that, @IvanNardi ?

The long term goal should be to get rid of all *printf()s even those that are currently replaced and use only the logging callback together with logging facilities.

Copy link
Collaborator

@IvanNardi IvanNardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two notes:

  • we can probably remove the define DGA_DEBUG from ndpi_main.c and convert the printf in ndpi_ends_with with a standard NDPI_LOG_DBG2 (not a NDPI_LOG_DGA because it is used also by HTTP code)
  • there are still some if(ndpi_verbose_dga_detection) that can probably be removed

Other than that, it seems ok to me. Adding the facility might be a little overwhelming right now, but it serves its scope and it might be useful in future.

@IvanNardi
Copy link
Collaborator

@utoni, any updates on this PR?

@utoni
Copy link
Collaborator Author

utoni commented Sep 10, 2023

I kind of forgot about the PR and the remaining ToDo.

@utoni utoni force-pushed the improved/logging_callback_ndpi_printf branch 6 times, most recently from 259ab20 to 6885e17 Compare September 26, 2023 18:13
@utoni utoni requested a review from IvanNardi September 26, 2023 18:32
 * logging is instead redirected to `ndpi_debug_printf`

Signed-off-by: lns <[email protected]>
Signed-off-by: Toni Uhlig <[email protected]>
@utoni utoni force-pushed the improved/logging_callback_ndpi_printf branch from 6885e17 to 718e367 Compare September 26, 2023 20:37
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Collaborator

@IvanNardi IvanNardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@utoni utoni merged commit ef3adb9 into ntop:dev Sep 26, 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

Successfully merging this pull request may close these issues.

2 participants