Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 88228d74
authored
Apr 09, 2019
by
javiertury
Committed by
Sushant
Apr 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: inspect with logger (#10703)
1 parent
cccd33f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
lib/sql-string.js
lib/utils/logger.js
lib/sql-string.js
View file @
88228d7
'use strict'
;
'use strict'
;
const
dataTypes
=
require
(
'./data-types'
);
const
dataTypes
=
require
(
'./data-types'
);
const
util
=
require
(
'util
'
);
const
{
logger
}
=
require
(
'./utils/logger
'
);
function
arrayToList
(
array
,
timeZone
,
dialect
,
format
)
{
function
arrayToList
(
array
,
timeZone
,
dialect
,
format
)
{
return
array
.
reduce
((
sql
,
val
,
i
)
=>
{
return
array
.
reduce
((
sql
,
val
,
i
)
=>
{
...
@@ -62,7 +62,7 @@ function escape(val, timeZone, dialect, format) {
...
@@ -62,7 +62,7 @@ function escape(val, timeZone, dialect, format) {
}
}
if
(
!
val
.
replace
)
{
if
(
!
val
.
replace
)
{
throw
new
Error
(
`Invalid value
${
util
.
inspect
(
val
)}
`
);
throw
new
Error
(
`Invalid value
${
logger
.
inspect
(
val
)}
`
);
}
}
if
(
dialect
===
'postgres'
||
dialect
===
'sqlite'
||
dialect
===
'mssql'
)
{
if
(
dialect
===
'postgres'
||
dialect
===
'sqlite'
||
dialect
===
'mssql'
)
{
...
...
lib/utils/logger.js
View file @
88228d7
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
*/
*/
const
debug
=
require
(
'debug'
);
const
debug
=
require
(
'debug'
);
const
util
=
require
(
'util'
);
class
Logger
{
class
Logger
{
constructor
(
config
)
{
constructor
(
config
)
{
...
@@ -24,6 +25,10 @@ class Logger {
...
@@ -24,6 +25,10 @@ class Logger {
console
.
warn
(
`(
${
this
.
config
.
context
}
) Warning:
${
message
}
`
);
console
.
warn
(
`(
${
this
.
config
.
context
}
) Warning:
${
message
}
`
);
}
}
inspect
(
value
)
{
return
util
.
inspect
(
value
,
false
,
3
);
}
debugContext
(
name
)
{
debugContext
(
name
)
{
return
debug
(
`
${
this
.
config
.
context
}
:
${
name
}
`
);
return
debug
(
`
${
this
.
config
.
context
}
:
${
name
}
`
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment