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 79c1f73c
authored
May 01, 2012
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use wrapped console.log function if console.log is passed as logging method
1 parent
7ea1f5f4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
3 deletions
lib/dialects/mysql/query.js
lib/dialects/sqlite/query.js
lib/migrator.js
lib/sequelize.js
spec/sqlite/dao.spec.js
lib/dialects/mysql/query.js
View file @
79c1f73
...
@@ -12,6 +12,16 @@ module.exports = (function() {
...
@@ -12,6 +12,16 @@ module.exports = (function() {
raw
:
false
raw
:
false
},
options
||
{})
},
options
||
{})
if
(
this
.
options
.
logging
===
true
)
{
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
this
.
options
.
logging
=
console
.
log
}
if
(
this
.
options
.
logging
==
console
.
log
)
{
// using just console.log will break in node < 0.6
this
.
options
.
logging
=
function
(
s
)
{
console
.
log
(
s
)
}
}
this
.
bindClientFunction
=
function
(
err
)
{
onFailure
.
call
(
self
,
err
)
}
this
.
bindClientFunction
=
function
(
err
)
{
onFailure
.
call
(
self
,
err
)
}
}
}
Utils
.
_
.
extend
(
Query
.
prototype
,
require
(
"../query"
).
prototype
)
Utils
.
_
.
extend
(
Query
.
prototype
,
require
(
"../query"
).
prototype
)
...
...
lib/dialects/sqlite/query.js
View file @
79c1f73
...
@@ -9,6 +9,16 @@ module.exports = (function() {
...
@@ -9,6 +9,16 @@ module.exports = (function() {
plain
:
false
,
plain
:
false
,
raw
:
false
raw
:
false
},
options
||
{})
},
options
||
{})
if
(
this
.
options
.
logging
===
true
)
{
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
this
.
options
.
logging
=
console
.
log
}
if
(
this
.
options
.
logging
==
console
.
log
)
{
// using just console.log will break in node < 0.6
this
.
options
.
logging
=
function
(
s
)
{
console
.
log
(
s
)
}
}
}
}
Utils
.
_
.
extend
(
Query
.
prototype
,
require
(
"../query"
).
prototype
)
Utils
.
_
.
extend
(
Query
.
prototype
,
require
(
"../query"
).
prototype
)
...
@@ -17,8 +27,9 @@ module.exports = (function() {
...
@@ -17,8 +27,9 @@ module.exports = (function() {
this
.
sql
=
sql
this
.
sql
=
sql
if
(
this
.
options
.
logging
!==
false
)
if
(
this
.
options
.
logging
!==
false
)
{
this
.
options
.
logging
(
'Executing: '
+
this
.
sql
)
this
.
options
.
logging
(
'Executing: '
+
this
.
sql
)
}
this
.
database
.
serialize
(
function
()
{
this
.
database
.
serialize
(
function
()
{
var
isInsertCommand
=
(
self
.
sql
.
toLowerCase
().
indexOf
(
'insert'
)
==
0
)
var
isInsertCommand
=
(
self
.
sql
.
toLowerCase
().
indexOf
(
'insert'
)
==
0
)
...
...
lib/migrator.js
View file @
79c1f73
...
@@ -20,6 +20,11 @@ module.exports = (function() {
...
@@ -20,6 +20,11 @@ module.exports = (function() {
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
this
.
options
.
logging
=
console
.
log
this
.
options
.
logging
=
console
.
log
}
}
if
(
this
.
options
.
logging
==
console
.
log
)
{
// using just console.log will break in node < 0.6
this
.
options
.
logging
=
function
(
s
)
{
console
.
log
(
s
)
}
}
}
}
Object
.
defineProperty
(
Migrator
.
prototype
,
"queryInterface"
,
{
Object
.
defineProperty
(
Migrator
.
prototype
,
"queryInterface"
,
{
...
...
lib/sequelize.js
View file @
79c1f73
...
@@ -13,7 +13,8 @@ module.exports = (function() {
...
@@ -13,7 +13,8 @@ module.exports = (function() {
port
:
3306
,
port
:
3306
,
define
:
{},
define
:
{},
query
:
{},
query
:
{},
sync
:
{}
sync
:
{},
logging
:
console
.
log
},
options
||
{})
},
options
||
{})
if
(
this
.
options
.
logging
===
true
)
{
if
(
this
.
options
.
logging
===
true
)
{
...
...
spec/sqlite/dao.spec.js
View file @
79c1f73
...
@@ -11,7 +11,7 @@ describe('SQLite', function() {
...
@@ -11,7 +11,7 @@ describe('SQLite', function() {
var
self
=
this
var
self
=
this
this
.
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
this
.
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
tru
e
,
logging
:
fals
e
,
dialect
:
'sqlite'
dialect
:
'sqlite'
})
})
...
...
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