good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
upper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
open
upper
Commits
f10e0a82
Commit
f10e0a82
authored
Jul 4, 2015
by
José Carlos Nieto
Browse files
Options
Downloads
Patches
Plain Diff
Adding "debug" build tag.
parent
e9be46b6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.go
+5
-0
5 additions, 0 deletions
config.go
config_debug.go
+5
-0
5 additions, 0 deletions
config_debug.go
util/sqlutil/debug.go
+7
-8
7 additions, 8 deletions
util/sqlutil/debug.go
with
17 additions
and
8 deletions
config.go
0 → 100644
+
5
−
0
View file @
f10e0a82
// +build !debug
package
db
var
Debug
=
false
This diff is collapsed.
Click to expand it.
config_debug.go
0 → 100644
+
5
−
0
View file @
f10e0a82
// +build debug
package
db
var
Debug
=
true
This diff is collapsed.
Click to expand it.
util/sqlutil/debug.go
+
7
−
8
View file @
f10e0a82
...
...
@@ -30,6 +30,12 @@ import (
"upper.io/db"
)
func
init
()
{
if
os
.
Getenv
(
db
.
EnvEnableDebug
)
!=
""
{
db
.
Debug
=
true
}
}
// Debug is used for printing SQL queries and arguments.
type
Debug
struct
{
SQL
string
...
...
@@ -63,15 +69,8 @@ func (d *Debug) Print() {
log
.
Printf
(
"
\n\t
%s
\n\n
"
,
strings
.
Join
(
s
,
"
\n\t
"
))
}
func
IsDebugEnabled
()
bool
{
if
os
.
Getenv
(
db
.
EnvEnableDebug
)
!=
""
{
return
true
}
return
false
}
func
Log
(
query
string
,
args
[]
interface
{},
err
error
,
start
int64
,
end
int64
)
{
if
Is
Debug
Enabled
()
{
if
db
.
Debug
{
d
:=
Debug
{
query
,
args
,
err
,
start
,
end
}
d
.
Print
()
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment