<commit_before>#Console

Console package implements multi priority logger.

## Usage

### Basic Usage

The standard log uses `os.Stdout`:

	c := console.Std()
	c.Info("This is console")

### Custom Logger

You can define your custom logger and use it:

	// Create a *log.Logger
	var custom = console.New(console.Cfg{
		Color: true, 
		Date: console.DateFull,
	}, w)
	custom.Trace("Ignored message %d", 1)
	custom.Info("Message not ignored %d", 1)

## Features

### Runtime execution

You can use a `func() string` as argument. Instead
of the function the result string will be printed.
If the message is ignored the function will not be executed.

	// Very expensive struct method
	var a func() string = myObject.createTreeString
	// Very expensive interface method
	var b func() string = myInterface.createTreeString

	l := console.New(console.Cfg{Lvl: console.LvlDebug})
	// func a is executed
	l.Info("Method result: %s", a)
	// func b is ignored
	l.Trace("Method result: %s", b)

### Hooks

An hook is interface used to capture certain conditions and execute an action.
Here's an example:

	type MailHook struct {
		lvl  console.LogLevel
		Addr string
		Auth Auth
		From string
		To   []string
	}

	func (m *MailHook) Match(l console.LogLevel, format string, args ...interface{}) bool {
		return l >= m.lvl
	}

	func (m *MailHook) Action(l LogLevel, msg string){
		smtp.SendMail(m.Addr, m.Auth, m.From, m.To, fmt.Sprintf("[%s] from MailHook: %s\n\n%s", l, fileline, msg)
	}


This hook captures the messages from a certain level and sends an email with the message content.

## Help

For a complete reference read the [Godoc](http://godoc.org/github.com/klaidliadon/console "Documentation")
<commit_msg>Updated Readme with gopkg.in url<commit_after>#Console

Console package implements multi priority logger.

## Usage

### Basic Usage

The standard log uses `os.Stdout`:

	c := console.Std()
	c.Info("This is console")

### Custom Logger

You can define your custom logger and use it:

	// Create a *log.Logger
	var custom = console.New(console.Cfg{
		Color: true, 
		Date: console.DateFull,
	}, w)
	custom.Trace("Ignored message %d", 1)
	custom.Info("Message not ignored %d", 1)

## Features

### Runtime execution

You can use a `func() string` as argument. Instead
of the function the result string will be printed.
If the message is ignored the function will not be executed.

	// Very expensive struct method
	var a func() string = myObject.createTreeString
	// Very expensive interface method
	var b func() string = myInterface.createTreeString

	l := console.New(console.Cfg{Lvl: console.LvlDebug})
	// func a is executed
	l.Info("Method result: %s", a)
	// func b is ignored
	l.Trace("Method result: %s", b)

### Hooks

An hook is interface used to capture certain conditions and execute an action.

Here's an example:

	type MailHook struct {
		lvl  console.LogLevel
		Addr string
		Auth Auth
		From string
		To   []string
	}

	func (m *MailHook) Match(l console.LogLevel, format string, args ...interface{}) bool {
		return l >= m.lvl
	}

	func (m *MailHook) Action(l LogLevel, msg string){
		smtp.SendMail(m.Addr, m.Auth, m.From, m.To, fmt.Sprintf("[%s] from MailHook: %s\n\n%s", l, fileline, msg)
	}


This hook captures the messages from a certain level and sends an email with the message content.

## Help

For a complete reference read the [docs](https://godoc.org/gopkg.in/klaidliadon/console.v1 "Godoc").

{'fraction_non_alphanumeric': 0.11347724620770128, 'fraction_numerical': 0.0014585764294049008, 'mean_word_length': 3.8363892806770097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2575349', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1078, 'n_words': 418}