Skip to content

[helper] add log()#1389

Closed
leesei wants to merge 3 commits intohexojs:masterfrom
leesei:master
Closed

[helper] add log()#1389
leesei wants to merge 3 commits intohexojs:masterfrom
leesei:master

Conversation

@leesei
Copy link
Copy Markdown
Member

@leesei leesei commented Jul 15, 2015

Good for logging objects in theme and plugin

Changes to be committed:
modified: lib/plugins/helper/debug.js
modified: lib/plugins/helper/index.js

Good for logging objects in theme and plugin

 Changes to be committed:
	modified:   lib/plugins/helper/debug.js
	modified:   lib/plugins/helper/index.js
@Xuanwo
Copy link
Copy Markdown
Contributor

Xuanwo commented Jul 15, 2015

Add more coverage test?

@leesei
Copy link
Copy Markdown
Member Author

leesei commented Jul 15, 2015

K, but I think I can only asset(true) for the serverLog() test.

@tommy351
Copy link
Copy Markdown
Member

The name serverLog does not make sense. This helper just called console.log.

@leesei
Copy link
Copy Markdown
Member Author

leesei commented Jul 15, 2015

That's to distinguish between printing script and calling browser's
console.log()
I used to have the latter function but not finding it very useful.

What's your take on the name?

BTW, can I detect serve and generate command in helper? I am thinking
about automatically disabling this function in commands other than server.
On Jul 15, 2015 7:50 PM, "Tommy Chen" notifications@github.com wrote:

The name serverLog does not make sense. This helper just called
console.log.


Reply to this email directly or view it on GitHub
#1389 (comment).

@tommy351
Copy link
Copy Markdown
Member

If you only want to enable this helper in the server. You should move this helper to https://github.com/hexojs/hexo-server

@tommy351
Copy link
Copy Markdown
Member

And I think log or print would be a better name for this helper.

@leesei
Copy link
Copy Markdown
Member Author

leesei commented Jul 15, 2015

I don't think we can get the server object or call its function in templates, right?

leesei added 2 commits July 16, 2015 01:55
 Changes to be committed:
	modified:   lib/plugins/helper/debug.js
	modified:   lib/plugins/helper/index.js
 Changes to be committed:
	new file:   test/scripts/helpers/debug.js
	modified:   test/scripts/helpers/index.js
@leesei leesei changed the title [helper] add serverLog() [helper] add log() Jul 15, 2015
@leesei leesei closed this Jul 16, 2015
@leesei leesei mentioned this pull request Jul 16, 2015
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