<commit_before>// Copyright (c) 2015, <NAME>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library dlog.example;

import "package:dlog/dlog.dart" as dlog;
import "dart:convert";

getJSON() {
  var data = '''
[
  {
    "_id": "54bde2ec6d0c45fe2aad89a1",
    "index": 0,
    "guid": "391ad3b0-e003-44fe-8f52-9a53b0d2ce52",
    "isActive": true,
    "balance": "\$3,385.54",
    "picture": "http://placehold.it/32x32",
    "age": 25,
    "eyeColor": "blue",
    "name": "<NAME>",
    "gender": "male",
    "company": "COMTRAIL",
    "email": "<EMAIL>",
    "phone": "+1 (829) 415-3400",
    "address": "496 Hemlock Street, Hegins, New Mexico, 4698",
    "about": "Qui ex labore irure proident aute veniam sit minim Lorem irure. Est officia quis amet dolor duis velit pariatur culpa elit in aliqua aute magna. Occaecat et proident ut ea sit dolore aliquip. Ipsum minim esse ad et deserunt. Ad sit amet occaecat sint. Ipsum anim commodo ex eiusmod reprehenderit exercitation sit mollit proident aliqua. Occaecat reprehenderit mollit voluptate tempor nostrud qui anim veniam est laboris qui pariatur.\r\n",
    "registered": "2014-09-19T00:05:13 -05:00",
    "latitude": -2.302439,
    "longitude": 92.194414,
    "tags": [
      "commodo",
      "eu",
      "deserunt",
      "quis",
      "dolor",
      "nulla",
      "ad"
    ],
    "friends": [
      {
        "id": 0,
        "name": "<NAME>"
      },
      {
        "id": 1,
        "name": "<NAME>"
      },
      {
        "id": 2,
        "name": "<NAME>"
      }
    ],
    "greeting": "Hello, <NAME>! You have 3 unread messages.",
    "favoriteFruit": "strawberry"
  }
]
'''.replaceAll(new RegExp("\n|\r"), "");
  return JSON.decode(data);
}

main() {

  /**************************************
   * Json
   */

  // create Json object and
  var json = new dlog.Json(
      title: "My",
      data: new List()
  );

  json.data = getJSON();
  json.title += " json";

  // max length for string (set null for output full string)
  json.maxStringLen = 50;

  // custom data parsers (custom parsers for List, Map and String types will be ignored)
  json.parsers["int"] = (int num) => "$num <-- int";

  // output
  print(json);

  json.flush = true;
  json.maxStringLen = 10;
  print(json);

}
<commit_msg>Fix library name for json exmaple<commit_after>// Copyright (c) 2015, <NAME>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library dlog.example.json;

import "package:dlog/dlog.dart" as dlog;
import "dart:convert";

getJSON() {
  var data = '''
[
  {
    "_id": "54bde2ec6d0c45fe2aad89a1",
    "index": 0,
    "guid": "391ad3b0-e003-44fe-8f52-9a53b0d2ce52",
    "isActive": true,
    "balance": "\$3,385.54",
    "picture": "http://placehold.it/32x32",
    "age": 25,
    "eyeColor": "blue",
    "name": "<NAME>",
    "gender": "male",
    "company": "COMTRAIL",
    "email": "<EMAIL>",
    "phone": "+1 (829) 415-3400",
    "address": "496 Hemlock Street, Hegins, New Mexico, 4698",
    "about": "Qui ex labore irure proident aute veniam sit minim Lorem irure. Est officia quis amet dolor duis velit pariatur culpa elit in aliqua aute magna. Occaecat et proident ut ea sit dolore aliquip. Ipsum minim esse ad et deserunt. Ad sit amet occaecat sint. Ipsum anim commodo ex eiusmod reprehenderit exercitation sit mollit proident aliqua. Occaecat reprehenderit mollit voluptate tempor nostrud qui anim veniam est laboris qui pariatur.\r\n",
    "registered": "2014-09-19T00:05:13 -05:00",
    "latitude": -2.302439,
    "longitude": 92.194414,
    "tags": [
      "commodo",
      "eu",
      "deserunt",
      "quis",
      "dolor",
      "nulla",
      "ad"
    ],
    "friends": [
      {
        "id": 0,
        "name": "<NAME>"
      },
      {
        "id": 1,
        "name": "<NAME>"
      },
      {
        "id": 2,
        "name": "<NAME>"
      }
    ],
    "greeting": "Hello, <NAME>! You have 3 unread messages.",
    "favoriteFruit": "strawberry"
  }
]
'''.replaceAll(new RegExp("\n|\r"), "");
  return JSON.decode(data);
}

main() {

  /**************************************
   * Json
   */

  // create Json object and
  var json = new dlog.Json(
      title: "My",
      data: new List()
  );

  json.data = getJSON();
  json.title += " json";

  // max length for string (set null for output full string)
  json.maxStringLen = 50;

  // custom data parsers (custom parsers for List, Map and String types will be ignored)
  json.parsers["int"] = (int num) => "$num <-- int";

  // output
  print(json);

  json.flush = true;
  json.maxStringLen = 10;
  print(json);

}

{'fraction_non_alphanumeric': 0.17201786093982566, 'fraction_numerical': 0.045502870508186265, 'mean_word_length': 2.695208169677926, 'pattern_counts': {'":': 56, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, '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': '7103558', 'n_tokens_mistral': 1864, 'n_tokens_neox': 1697, 'n_words': 489}