Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@Joshna907
Copy link
Contributor

Changes made -
Replaced all log.Printf calls with zap structured logs.
Added logger := zap.L() at the top of the handler.

// @Router /dashboard [get]
func GetDashboardData(c *gin.Context) {

logger := zap.L()
Copy link
Contributor

@ChayanDass ChayanDass Nov 26, 2025

Choose a reason for hiding this comment

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

No need to initiate the logger, there is already a wrapper log.go, you can see main.go as a reference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done!!!

Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment has not been addressed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already fixed that earlier, but I mistakenly pushed the change to another branch. I’ve now applied the same fix to this PR branch as well.

@ChayanDass
Copy link
Contributor

ok, looks good!

Just 1 more thing, import the log package as logger

logger "github.com/fossology/LicenseDb/pkg/log"

and squash all commits into one, and sign your commit, and make sure your commit follows our commit convention

@Joshna907 Joshna907 force-pushed the zap-logger-dashboard branch from 7627ea2 to 197ed50 Compare November 28, 2025 06:43
@Joshna907
Copy link
Contributor Author

Joshna907 commented Nov 28, 2025

Done!!!

@Joshna907
Copy link
Contributor Author

Hi! Just wanted to check if there’s anything else needed from my end for this PR ?

@Joshna907 Joshna907 force-pushed the zap-logger-dashboard branch 2 times, most recently from cb995ea to 1620c53 Compare December 2, 2025 15:15
@deo002
Copy link
Collaborator

deo002 commented Dec 5, 2025

Hi! Just wanted to check if there’s anything else needed from my end for this PR ?

Yes, as Chayan said, squash all your commits into a single commit. Instructions here: squashing commits ,
and,
verify your commit.

@Joshna907 Joshna907 force-pushed the zap-logger-dashboard branch from 1620c53 to 15da6ca Compare December 5, 2025 13:19
@Joshna907
Copy link
Contributor Author

Squashed and signed!!

@deo002
Copy link
Collaborator

deo002 commented Dec 9, 2025

We have some import errors. Some tests are failing in the pipeline. Please click on the individual tests and see why they fail.

@Joshna907 Joshna907 force-pushed the zap-logger-dashboard branch from 9dfbc37 to a1e8573 Compare December 9, 2025 17:43
@Joshna907
Copy link
Contributor Author

All test cases are passing now

iso8601StartOfMonth := startOfMonth.Format(time.RFC3339)
if err := db.DB.Model(&models.Audit{}).Where("timestamp > ? AND type='license'", iso8601StartOfMonth).Count(&licenseChangesSinceLastMonth).Error; err != nil {
log.Printf("\033[31mError: error fetching audits count: %s\033[0m", err.Error())
logger.LogError("error fetching users count", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you check all the logs properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Chayan, done!! see it last time

Select("rf_risk as risk, count(*) as count").
Group("rf_risk").
Scan(&licenseFrequency).Error; err != nil {
logger.LogError("error fetching users count", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

Check those lines!

@Joshna907 Joshna907 force-pushed the zap-logger-dashboard branch 2 times, most recently from 10644be to 3c949c0 Compare December 11, 2025 08:20
Signed-off-by: Joshna Waikar <joshnawaikar@gmail.com>
@Joshna907 Joshna907 force-pushed the zap-logger-dashboard branch from e7dd96c to 0d39965 Compare December 13, 2025 11:42
Copy link
Contributor

@ChayanDass ChayanDass left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.