<commit_before>import 'dart:io';
import 'package:args/args.dart';
import 'package:shelf/shelf_io.dart' as io;
import 'package:shelf_static/shelf_static.dart';

const int DEFAULT_PORT = 8080;

void main(List args) {
  var port = DEFAULT_PORT;

  var argParser = new ArgParser();
  argParser.addOption('port', abbr: 'p', defaultsTo: DEFAULT_PORT.toString(),
                      help: 'The port to listen on.', valueHelp: 'port', callback: (_port) {
    port = int.parse(_port, onError: (source) {
      stderr.writeln('ERROR: Port must be a number.');
      exit(1);
    });
  });
  argParser.addFlag('help', negatable: false, help: 'Displays the help.', callback: (help) {
    if (help) {
      print(argParser.getUsage());
      exit(1);
    }
  });

  argParser.parse(args);

  var handler = createStaticHandler(Directory.current.path,
                                    defaultDocument: 'index.html');

  io.serve(handler, 'localhost', port).then((_) => print('Server started on port $port'));
}<commit_msg>enable logging<commit_after>import 'dart:io';
import 'package:args/args.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as io;
import 'package:shelf_static/shelf_static.dart';

const int DEFAULT_PORT = 8080;

void main(List args) {
  var port = DEFAULT_PORT;

  var argParser = new ArgParser();
  argParser.addOption('port', abbr: 'p', defaultsTo: DEFAULT_PORT.toString(),
                      help: 'The port to listen on.', valueHelp: 'port', callback: (_port) {
    port = int.parse(_port, onError: (source) {
      stderr.writeln('ERROR: Port must be a number.');
      exit(1);
    });
  });
  argParser.addFlag('help', negatable: false, help: 'Displays the help.', callback: (help) {
    if (help) {
      print(argParser.getUsage());
      exit(1);
    }
  });

  argParser.parse(args);

  var handler = createStaticHandler(Directory.current.path, defaultDocument: 'index.html');

  var pipeline = const Pipeline().addMiddleware(logRequests()).addHandler(handler);

  io.serve(pipeline, 'localhost', port).then((_) => print('Server started on port $port'));
}
{'fraction_non_alphanumeric': 0.15639810426540285, 'fraction_numerical': 0.005687203791469194, 'mean_word_length': 3.6911111111111112, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4367911', 'n_tokens_mistral': 697, 'n_tokens_neox': 668, 'n_words': 161}