Comments (8)
log isn't defined in json-template.js. It's only defined in test-helpers.js.
Are
you using an old version?
Original comment by [email protected]
on 20 Apr 2009 at 7:01
from json-template.
I refer to you to line 23 on the current trunk.
To quote it:
// This is predefined in tests, shouldn't be defined anywhere else. TODO: Do
// something nicer.
var log = log || function() {};
Original comment by [email protected]
on 20 Apr 2009 at 9:01
from json-template.
Oh, perhaps you don't consider this a definition of 'log'. It's just
frustrating if
you want to change this and make log messages from json-template somewhere
else, as
you'd write:
var log = function() {};
which would result in logs being turned off for *everything*.
Any log configuration system that json-template adopts to change whether you
want to
log or not will need to modify the behavior of log, if you refer to it under
this
global name.
Original comment by [email protected]
on 20 Apr 2009 at 9:05
from json-template.
It doesn't "clobber" the log function -- it uses the one that's there if it
*already*
exists.
I agree that customizing the log function would be useful... if you have a
scheme
that works for you please send in a patch.
Original comment by [email protected]
on 20 Apr 2009 at 9:15
from json-template.
It does write to 'log', just will write the same value back. I'm
fine to retract the word 'clobber'. :)
Whatever it does, this approach makes it impossible to do something
*else* with that line like shut down json-template's voluminous
logging (while being interested in other logging by other js code), as the
global name 'log' is in use throughout the json-template code. Perhaps there's
some other way to selectively shut down logging from particular javascript
modules?
In our copy of json-template we now renamed the uses of log to log2 so
we can shut down logging in json-template specifically when we want
to. That's hardly ideal. I'll look into a approach that does work
where json-template uses _log instead, adding an api to manipulate the logging
situation.
Original comment by [email protected]
on 21 Apr 2009 at 7:56
from json-template.
Original comment by [email protected]
on 21 Apr 2009 at 4:51
- Changed title: configurable log function (javascript)
from json-template.
I recommend dropping the globally-visible logging hook in favor of a
locally-scoped
one. So, define a "log()" function on one of the json-template classes, and
provide
examples of how the user can attach it to the global "log()" function or a
user-defined function. By default, leave this local "log()" function defined
as a
no-op for best performance.
Original comment by Robert.David.Williams
on 14 May 2009 at 7:50
from json-template.
Yes, I agree with that approach. log() shouldn't be in the global namespace.
Original comment by [email protected]
on 15 May 2009 at 5:52
from json-template.
Related Issues (20)
- Unbalanced section push and pop in the Java implementation HOT 3
- Add a LISP-style "let" statement
- A predicate containing the text 'or' results in a template parsing error
- typo in UrlParamsJsonTemplateFormatter HOT 2
- Error in JsonTemplateModule::FromFile() HOT 1
- Iteration over dictionary - Patch for /python/jsontemplate/_jsontemplate.py HOT 1
- Iteration over dictionary - Patch for /python/jsontemplate/_jsontemplate.py HOT 1
- cannot pip install json-template
- Javascript within JSON templates HOT 1
- <img> src being ignored. HOT 1
- Possibly a typo introduced by revision cc10d7e78b94 HOT 1
- HTML formatter doesn't work for numeric values HOT 2
- expand sometime return blank HOT 1
- Patch for /jesyll-doc/__config.json
- token_re_cache in javascript implementation doesn't do anything? HOT 2
- Setup.py dependency chaining broken; fix enclosed HOT 1
- Python 3 diff HOT 1
- json data formte with metdata of object HOT 1
- Iteration over dictionary (patch) HOT 2
- saite de filmes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-template.