Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support logs with with fields and _source #13

Open
xmlking opened this issue Aug 13, 2019 · 0 comments
Open

support logs with with fields and _source #13

xmlking opened this issue Aug 13, 2019 · 0 comments

Comments

@xmlking
Copy link

xmlking commented Aug 13, 2019

With _source="registry/container.go:93" we can pinpoint source of the SQL logs

current logs with fields only

DEBU[2019-08-13T10:51:32-07:00] CREATE TABLE "users" ("created_at" datetime NOT NULL,"deleted_at" datetime,"email" varchar(255) NOT NULL,"first_name" varchar(255) NOT NULL,"id" uuid,"last_name" varchar(255) NOT NULL,"updated_at" datetime NOT NULL,"username" varchar(100) NOT NULL , PRIMARY KEY ("id")) [190.156µs]  module=gorm
DEBU[2019-08-13T10:51:32-07:00] CREATE INDEX idx_users_deleted_at ON "users"(deleted_at)  [76.138µs]  module=gorm
DEBU[2019-08-13T10:51:32-07:00] CREATE TABLE "profiles" ("avatar" varchar(255),"birthday" datetime NOT NULL,"created_at" datetime NOT NULL,"deleted_at" datetime,"gender" varchar(255),"id" uuid,"tz" varchar(255),"updated_at" datetime NOT NULL,"user_id" varchar(255) , PRIMARY KEY ("id")) [80.66µs]  module=gorm
DEBU[2019-08-13T10:51:32-07:00] CREATE INDEX idx_profiles_deleted_at ON "profiles"(deleted_at)  [65.971µs]  module=gorm

logs with with fields and _source

DEBU[2019-08-13T10:53:23-07:00] CREATE TABLE "users" ("created_at" datetime NOT NULL,"deleted_at" datetime,"email" varchar(255) NOT NULL,"first_name" varchar(255) NOT NULL,"id" uuid,"last_name" varchar(255) NOT NULL,"updated_at" datetime NOT NULL,"username" varchar(100) NOT NULL , PRIMARY KEY ("id"))  _source="registry/container.go:93" module=gorm type=sql
DEBU[2019-08-13T10:53:23-07:00] CREATE INDEX idx_users_deleted_at ON "users"(deleted_at)   _source="registry/container.go:93" module=gorm type=sql
DEBU[2019-08-13T10:53:23-07:00] CREATE TABLE "profiles" ("avatar" varchar(255),"birthday" datetime NOT NULL,"created_at" datetime NOT NULL,"deleted_at" datetime,"gender" varchar(255),"id" uuid,"tz" varchar(255),"updated_at" datetime NOT NULL,"user_id" varchar(255) , PRIMARY KEY ("id"))  _source="registry/container.go:99" module=gorm type=sql
DEBU[2019-08-13T10:53:23-07:00] CREATE INDEX idx_profiles_deleted_at ON "profiles"(deleted_at)   _source="registry/container.go:99" module=gorm type=sql
xmlking added a commit to xmlking/logrus that referenced this issue Aug 13, 2019
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

No branches or pull requests

1 participant