adamschwartz / log Goto Github PK
View Code? Open in Web Editor NEWConsole.log with style.
Home Page: https://adamschwartz.co/log
License: MIT License
Console.log with style.
Home Page: https://adamschwartz.co/log
License: MIT License
Hola, personalmente uso mucho http://craig.is/writing/chrome-logger y me encantaria que este tenga la facilidad de integrarlo en un paso a este otro componente.
Doesn't come up with anything in unsupported browsers.
Perhaps still allowing non-formatted versions of the errors to still be shown. Some sort of graceful degradation maybe.
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library adamschwartz/log
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "adamschwartz/log",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
The Safari Web Inspector in today's WebKit Nightly now supports "%c" in format strings. http://nightly.webkit.org (r148526 or later). This also works when remotely inspecting iOS devices. Screenshot:
Currently log.js disables support for Safari. It would be great if this was enabled for WebKit Nighty users using the Safari Web Inspector right now.
A common way to detect a WebKit Nightly user is to check for a +
in WebKit number in the UserAgent, e.g. AppleWebKit/537.38+
.
Safari 6.0.4:
// js> navigator.userAgent
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.29.13 (KHTML, like Gecko) Version/6.0.4 Safari/536.29.13"
WebKit Nightly:
// js> navigator.userAgent
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.38+ (KHTML, like Gecko) Version/6.0.4 Safari/536.29.13"
It would be great if you allowed to install/update using bower.
Thanks!
How do i put it on my website?
I got this error message from Chrome when trying to import log.js via a <script>:
Refused to execute script from 'https://github.com/adamschwartz/log/blob/master/log.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I am running newest version of Chrome.
log('[c="color: red"][data][c]');
(Separating this out from #12 since that was a combination of a number of bugs.)
https://github.com/adamschwartz/log/blob/master/README.md#demo
From http://adamschwartz.co/log
to http://adamschwartz.co/log/
.
Skips a redirect.
I didn't know how to install this plugin.
Tested in Chrome 27.0.1453.12 dev, Firefox 19.0.2
log( "*(data)*")
Result: (data)
Expected: (data)
log("_(data)_")
Result: (data)
Expected: (data)
log('[c="color: red"](data)[c]')
Result: c='color: red'[c]
Expected: (data) in red color
log("*[data]*")
Result: [data]
OK
log("_[data]_")
Result: [data]
OK
log('[c="color: red"][data][c]')
Result: [c='color: red'][data][c]
Expected: [data] in red color
Including (){}\/
, and others.
Example:
log('`a == b`') # works
log('`a == (b + c)`') # fails
Developer preview is out, but the log.js script is accidentally returning false for safariSupports.
First off, Adam this is a brilliant piece of kit. Kudos.
I'm putting together a pack of Javascript libraries for Salesforce developers and would really love to include your library. One hitch, however, is the automatic inclusion of the file / line # of the invocation. I suspect that we'll always see log.js:19 on the right, but perhaps the file / line # of the invoking script can be included as a "tag" or something on the left ?
log("this is [c='color: red']red[c]")
# for easy debugging with coffee
log "this is [c='color: red']#{someVariable}[c]"
main.js
//the require library is configuring paths
require.config({
baseUrl: "../assets",
paths: {
//tries to load jQuery from Google's CDN first and falls back
//to load locally
log: ['log/log'],
ractive: ['//cdn.ractivejs.org/latest/ractive'],
rv: ["rv/rv"],
jquery: ['//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min', 'jquery/jquery'],
bootstrap: ['//netdna.bootstrapcdn.com/bootstrap/3.3.3/js/bootstrap.min', 'bootstrap/bootstrap'],
moment: ['moment/moment']
},
shim: {
'bootstrap': {
deps: ['jquery']
}
},
//how long the it tries to load a script before giving up, the default is 7
waitSeconds: 10
});
//requiring the scripts in the first argument and then passing the library namespaces into a callback
//you should be able to console log all of the callback arguments
require(['jquery', 'moment', 'log', 'ractive', 'rv'],
function ($, moment, log,Ractive, rv)
{
console.log(arguments, window.log);
log("Log by log");
});
})(require);
bower.json
{
"private": true,
"ignore": [
"**/.*",
"node_modules",
"app/assets",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap": "~3.3.4",
"jquery": "~2.1.3",
"fontawesome": "~4.3.0",
"moment": "~2.9.0",
"requirejs": "~2.1.16",
"rv": "~0.1.8",
"log": "~0.1.5"
}
}
.bowerrc
{
"directory": "app/assets"
}
Hello,
How it's possible to colorize an object's log ?
I've try
console.log($scope.myObject);
to
log('[c="color: #32c5d2"]' + $scope.myObject + '[c]');
The line is colorize but I can't click on the object for inspecting the properties
Possibly do something like this:
https://github.com/eriwen/javascript-stacktrace
Or like this:
__LINE__ = (new Error).stack.split("\n")[1].match(/:([0-9]+):/)[1]
https://news.ycombinator.com/item?id=5540763
See https://news.ycombinator.com/item?id=5540716 for more information.
If you have styles within styles it doesn't render properly.
eg. log('_[c="color:red"]ERROR[c]_')
doesn't make the font bold and red as expected. Also doesn't work if you swap the order.
Workaround, log('[c="color:red;font-weight:bold"]ERROR[c]')
Basically title says it all.
Hello Adam !
I didn't know what would be the best place to submit this update request ...
May I ask you why NPM version available isn't the latest ?
Following workaround works fine though : npm install -S https://github.com/adamschwartz/log
The latest NPM version (0.1.5) makes it unusable with Webpack, since it needs following bit of code which is present in v0.3.0
if (typeof define === 'function' && define.amd) {
define(function() {
return exportedLog;
});
Anyway thanks for your work !
Mat
Thinking the only difference is that in your regex we should allow for multiline?
It seems that log('this is a test
') matches code for test
but
log('this is a function () { hello; }
)
On the demo site (http://adamschwartz.co/log/), all console logs occur at line 19, rather than the line which called the log api.
Do you think that something like log('this is <style="color: red">red</style>')
makes the API syntax more specific? I think particularly in terms of beginners and consistency with HTML.
Best regards,
Rick
Hi Adam, I found your library whilst searching for source code to improve my understanding of regular expressions and console helper libraries.
I am very new to open source, but wondered if you think it would be a useful improvement to add a noConflict() method to the library (e.g. well known example in underscore.js). At least to me, it would seem that 'log' as a global object has the potential to conflict with other global variables given how close semantically it is to programming terminology in general. There are a lot of use cases for the word log!
Your documentation mentions that the syntax follows markdown styling, but that doesn't match what I found here: [(https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)]
Do you think there would be any benefit in getting these two to match? I would appreciate the opportunity to have a go at adding these features if you agree with my thinking. I would be happy to submit tests for the new code.
Regards,
Rick
Your documentation mentions that the syntax follows markdown styling, but that doesn't match what I found here: [(https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)]
Do you think there would be any benefit in getting these two to match?
Best,
Rick
The Chrome console (maybe other consoles?) can be cleared with clear()
. Typing just clear
is clearer (no pun intended) and classier. Just one line:
window.__defineGetter__('clear', function () { clear(); });
In Safari, the page thought I was in Chrome, and in Chrome the page thought I was in Safari. Firefox and Opera seem to be fine. I'm running OS X 10.8.2, Safari 6.0.2, Chrome 26.0.1410.65, and Chrome Canary 28.0.1466.0 canary.
Willing to make a PR for a feature similar to console.table(). Would this pr be welcome?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.