Console.log with style.

Related tags

Log console log js devtools
Overview

Log

Console.log with style

Demo

Features

  • Safely call log (instead of console.log) in any browser.
  • Use markdown syntax for quick formatting:
    • italiclog('this is *italic*')
    • boldlog('this word _bold_')
    • codelog('this word `code`')
  • Use a custom syntax to style text however you want: log('this is [c="color: red"]red[c]').

Support

Stylized logs are supported in the following browsers:

  • Chrome 26+
  • Firefox 31+ or with Firebug 1.11 beta 2 or later
  • Opera with Blink (15+)
  • Safari Nightly (537.38+)

Screenshot

Implementations

Comments
  • Undefined in requirejs

    Undefined in requirejs

    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"
    }
    
    opened by wenerme 6
  • Enable for the Safari Web Inspector in the WebKit Nightly

    Enable for the Safari Web Inspector in the WebKit Nightly

    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:

    Screen Shot 2013-04-16 at 9 30 19 PM

    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"
    
    opened by JosephPecoraro 5
  • Amended Pull Request

    Amended Pull Request

    I changed it up to use the more greedy .* and that will match anything inside of reference which is what we want anyway.

    Apologies for making a little mess. Confirmed it works with FF and Chrome isn't happy with WebKit Nightly

    opened by craniumslows 3
  • Chrome error message

    Chrome error message

    I got this error message from Chrome when trying to import log.js via a