Coder Social home page Coder Social logo

logatim's Issues

Pass objects through to browser console. (enhancement)

In the browser console, for the page logatim, if I do ...

 logatim.info("String log");

... then I get ...

String log

If I do ...

 console.log("String log");

... then I also get ...

String log

However, if I do ...

 logatim.info(this);

... I only get ...

[object Window]

... whereas, if I do ...

 console.log(this);

... then I will get ...

> Window {external: Object, chrome: Object, document: document, GoogleAnalyticsObject: "ga", React: Object…}

This allows me to browse the object directly, drilling down to check if everything is correct.

It would be great if you could retain that capability.

Free outputs

Stream anywhere.
This feature needs a hard rethinking on the config setting up.

Does not work with webpack

Hi. I have a nodeJs universal application bundled with webpack. I tried importing/requiring your library and using it but I see nothing on the console. Furthermore, if I try this: console.log(logatim); I get undefined on the console.

Add tests for styling

  • Ensure the right choose between browser or node styles.
  • Ensure colors, background and text styles using the .raw()

Add the raw function

It returns the current message as a string including the ANSI characters or HTML tags.

Useful for testing and the end-user may is interesting in not print the styles for some reason.

Customizable logger

Allow a middle step before output the message so the users can add their own formats.

Instead of:
logatim.info('Valar morghulis')

Do, for example:

logatim.info(() => `[${new Date}] Valar morghulis`)

Restore original color?

logatim.bgRed('Error').info(`: ${message}`);

I basically want the part after the colon to not have any styles at all, revert back to default.
Is there a method to reset styles? I couldn't find any real API docs, just a pretty page with not that much of any useful info in it.

The idea behind this library is great, I would really love to use it, I'm just trying to understand how.

Thank you!

Adapt the persist/get the level to be isomorphic

Remember to add this stunning feature to the README.md as a feature. Something like:
Don't worry for globals. You can require logatim anywhere and it will remember what log level you're using.

Don't print the entire object

I was printing an error object when I've noticed that all the information is not printed with logatim

The error printed by Logatim logatim.red.error(error):

SequelizeUniqueConstraintError: Validation error

The error printed by console.log( )

{ [SequelizeUniqueConstraintError: Validation error]
  name: 'SequelizeUniqueConstraintError',
  message: 'Validation error',
  errors:
   [ { message: 'PRIMARY must be unique',
       type: 'unique violation',
       path: 'PRIMARY',
       value: '[email protected]' } ],
  fields: { PRIMARY: '[email protected]' } }

But nevertheless if I print the object in this way with Logatim logatim.red.error(JSON.stringify(error))

{"name":"SequelizeUniqueConstraintError","message":"Validation error","errors":[{"message":"PRIMARY must be unique","type":"unique violation","path":"PRIMARY","value":"[email protected]"}],"fields":{"PRIMARY":"[email protected]"}}

Add logatim.config.js

So we can abstract the configuration from the implementation.

The config would be able to modify:

{
  level: {String | Number},
  channels: [{
     wagon: {Function}, // plug-in
     options: {Object}, 
     levels: {String []},
     test: {Regexp},
     exclude: {Regexp},
     replace: {Boolean}
  }],
  storageKey: {String}, // name used to store the logatim level
  env: {'node' | 'browser'},
  logMethods: {String []},
  verbose: {Boolean},
  infect: {Boolean}
}

require('logatim') returns undefined

Thanks for the lib, looks sweet. Having an issue getting it working though. I made a reduced test case, file tree looks like this:

- package.json
- node_modules/
    – logatim/
- index.js

index.js looks like this:

const logatim = require('logatim')

console.log(logatim) // undefined

That log returns undefined every time. I'm on Node v7.4.0 but this doesn't work in v6.2.1 either.

Demos would be awesome

For clientside (GH Pages, or JSBin) and serverside (Runnable?)

May be separate examples directory? Would be helpful to took at lib before downloading it. Thanks!

TypeError: e.join is not a function

I tried to use logatim (nodejs v5.5) but it gives an error:

$ npm install logatim
$ node
> const logatim = require('logatim');
undefined
> logatim.warn('oops')
TypeError: e.join is not a function
    at a (/home/jos/tmp/node_modules/logatim/dist/logatim.umd.min.js:1:3955)
    at i (/home/jos/tmp/node_modules/logatim/dist/logatim.umd.min.js:1:3818)
    at s (/home/jos/tmp/node_modules/logatim/dist/logatim.umd.min.js:1:3729)
    at repl:1:9
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:417:12)
    at emitOne (events.js:95:20)
    at REPLServer.emit (events.js:182:7)
> 

Am I overlooking something obvious?

Keeping the message in the queue for the next tick

Reproduce it as:

  1. logatim.red.error('red').blue('blue') // red (red color)
  2. logatim.green.error('green') // blue (blue color) green (green color)

It's keeping the blue message for the next tick. Should be overriden.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.