<commit_before>```
 _______  _______  _        _        _______  _______ _________     _______  _        _______  _        _______ 
(  ____ \(  ___  )( (    /|( (    /|(  ____ \(  ____ \\__   __/    (  ____ \( \      (  ___  )| \    /\(  ____ \
| (    \/| (   ) ||  \  ( ||  \  ( || (    \/| (    \/   ) (       | (    \/| (      | (   ) ||  \  / /| (    \/
| |      | |   | ||   \ | ||   \ | || (__    | |         | | _____ | (__    | |      | (___) ||  (_/ / | (__    
| |      | |   | || (\ \) || (\ \) ||  __)   | |         | |(_____)|  __)   | |      |  ___  ||   _ (  |  __)   
| |      | |   | || | \   || | \   || (      | |         | |       | (      | |      | (   ) ||  ( \ \ | (      
| (____/\| (___) || )  \  || )  \  || (____/\| (____/\   | |       | )      | (____/\| )   ( ||  /  \ \| (____/\
(_______/(_______)|/    )_)|/    )_)(_______/(_______/   )_(       |/       (_______/|/     \||_/    \/(_______/
                                                                                                                
```

Connect middleware which assigns a Flake ID to every request.

# Usage #

    $ npm install connect-flake

    // load connect-flake
    var flake = require('connect-flake');

    // use the middleware which sets req.uuid
    app.use(flake('eth0'));

    // add a dynamic helper so the view can see #{uuid}
    app.all(function(req, res, next) {
        res.locals.flake = req.flake;
    });

## Uses of a Flake ID for each Request ##

Log the Flake ID in your log files to help you figure out what is going on:

    // in your logging
    myLogger(req.flake + ' : Something bad happened.');

Tell the user the Flake ID for the failed request, and get them to use it as a reference when they report the issue to
you (note: this is a Jade template):

    p Your reference is '#{flake}'.

Send yourself the Flake ID of the (failed) request so you can find it quicker:

    To: <EMAIL>
    From: <EMAIL>
    Subject: 50x error
    
    A web request (013c7990a044-0000-08ff-00027298bef9) failed.

You may even store the requests and/or errors in your database:

    sql> SELECT * FROM request WHERE uuid = '013c7990a044-0000-08ff-00027298bef9';

And there are many other uses too.

# Motivation #

When you have so many requests, it's hard to grep (search, find, etc) the logs to figure out what went wrong when you
get a bad request. connect-flake to the rescue.

Add this module as connect middleware and each request has a Flake ID. When you log anything, make sure you log this
Flake ID with it. When you get an error in your application, make sure you use the Flake ID when reporting it (whether
that is logged, email or whatever). Also, tell the user (in their 50x page) what the Flake ID is when something goes
wrong, so that they can tell you to sort things out.

By doing all this, you can easily find the request and what really happened to it. You may keep detailed or light logs,
but either way having a direct reference to the request will really help.

## Note ##

This package was inspired by my other package [connect-uuid](https://github.com/appsattic/connect-uuid) which was inspired by
https://groups.google.com/forum/#!msg/nodejs/2NcBM7eXD94/FVm-jL91cekJ

# Author #

Written by [<NAME>](http://chilts.org/) - [Blog](http://chilts.org/blog/) -<commit_msg>Fix up some of the README<commit_after>```
 _______  _______  _        _        _______  _______ _________     _______  _        _______  _        _______ 
(  ____ \(  ___  )( (    /|( (    /|(  ____ \(  ____ \\__   __/    (  ____ \( \      (  ___  )| \    /\(  ____ \
| (    \/| (   ) ||  \  ( ||  \  ( || (    \/| (    \/   ) (       | (    \/| (      | (   ) ||  \  / /| (    \/
| |      | |   | ||   \ | ||   \ | || (__    | |         | | _____ | (__    | |      | (___) ||  (_/ / | (__    
| |      | |   | || (\ \) || (\ \) ||  __)   | |         | |(_____)|  __)   | |      |  ___  ||   _ (  |  __)   
| |      | |   | || | \   || | \   || (      | |         | |       | (      | |      | (   ) ||  ( \ \ | (      
| (____/\| (___) || )  \  || )  \  || (____/\| (____/\   | |       | )      | (____/\| )   ( ||  /  \ \| (____/\
(_______/(_______)|/    )_)|/    )_)(_______/(_______/   )_(       |/       (_______/|/     \||_/    \/(_______/
                                                                                                                
```

Connect middleware which assigns a Flake ID to every request.

# Usage #

    $ npm install connect-flake

    // load connect-flake
    var flake = require('connect-flake');

    // use the middleware which sets req.flake
    app.use(flake('eth0'));

    // add a dynamic helper so the view can see #{req.flake}
    app.all(function(req, res, next) {
        res.locals.flake = req.flake;
    });

## Uses of a Flake ID for each Request ##

Log the Flake ID in your log files to help you figure out what is going on:

    // in your logging
    myLogger(req.flake + ' : Something bad happened.');

Tell the user the Flake ID for the failed request, and get them to use it as a reference when they report the issue to
you (note: this is a Jade template):

    p Your reference is '#{flake}'.

Send yourself the Flake ID of the (failed) request so you can find it quicker:

    To: <EMAIL>
    From: <EMAIL>
    Subject: 50x error
    
    A web request (013c7990a044-0000-08ff-00027298bef9) failed.

You may even store the requests and/or errors in your database:

    sql> SELECT * FROM request WHERE id = '013c7990a044-0000-08ff-00027298bef9';

And there are many other uses too.

# Motivation #

When you have so many requests, it's hard to grep (search, find, etc) the logs to figure out what went wrong when you
get a bad request. connect-flake to the rescue.

Add this module as connect middleware and each request has a Flake ID. When you log anything, make sure you log this
Flake ID with it. When you get an error in your application, make sure you use the Flake ID when reporting it (whether
that is logged, email or whatever). Also, tell the user (in their 50x page) what the Flake ID is when something goes
wrong, so that they can tell you to sort things out.

By doing all this, you can easily find the request and what really happened to it. You may keep detailed or light logs,
but either way having a direct reference to the request will really help.

## Note ##

This package was inspired by my other package [connect-uuid](https://github.com/appsattic/connect-uuid) which was inspired by
https://groups.google.com/forum/#!msg/nodejs/2NcBM7eXD94/FVm-jL91cekJ

# Author #

Written by [<NAME>](http://chilts.org/) - [Blog](http://chilts.org/blog/) -
{'fraction_non_alphanumeric': 0.13444745558566698, 'fraction_numerical': 0.018367961457392352, 'mean_word_length': 1.8474067723960566, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 28, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6375004', 'n_tokens_mistral': 2271, 'n_tokens_neox': 2093, 'n_words': 663}