<commit_before>
require File.dirname(__FILE__) + '/ext/em'
require File.dirname(__FILE__) + '/ext/bytesize'
require File.dirname(__FILE__) + '/ext/json'
require File.dirname(__FILE__) + '/server/sublist'
require File.dirname(__FILE__) + '/server/options'
require File.dirname(__FILE__) + '/server/const'

require 'socket'
require 'fileutils'
require 'pp'

module NATS

  # Subscriber
  Subscriber = Struct.new(:conn, :subject, :sid)

  class Server
    
    class << self
      attr_reader :id, :info, :log_time, :auth_required, :debug_flag, :trace_flag
      alias auth_required? :auth_required
      alias debug_flag? :debug_flag
      alias trace_flag? :trace_flag
 
      def version; "nats server version #{NATS::VERSION}" end

      def host; @options[:addr]  end
      def port; @options[:port]  end
      def pid_file; @options[:pid_file] end

      def setup(argv)
        @options = {}

        parser.parse!(argv)
        read_config_file
        finalize_options

        @id = fast_uuid
        @sublist = Sublist.new
        @info = {
          :nats_server_id => Server.id,
          :version => VERSION,
          :auth_required => auth_required?,
          :max_payload => MAX_PAYLOAD_SIZE
        }

        # Write pid file if need be.
        File.open(@options[:pid_file], 'w') { |f| f.puts "#{Process.pid}" } if @options[:pid_file]

        # Check for daemon flag
        if @options[:daemonize]
          require 'rubygems'
          require 'daemons'
          log "Switching to daemon mode"
          Daemons.daemonize(:app_name => APP_NAME, :mode => :exec)
        end

        setup_logs
      end
      
      def subscribe(subscriber)<commit_msg>More TTY log messages for daemon mode<commit_after>
require File.dirname(__FILE__) + '/ext/em'
require File.dirname(__FILE__) + '/ext/bytesize'
require File.dirname(__FILE__) + '/ext/json'
require File.dirname(__FILE__) + '/server/sublist'
require File.dirname(__FILE__) + '/server/options'
require File.dirname(__FILE__) + '/server/const'

require 'socket'
require 'fileutils'
require 'pp'

module NATS

  # Subscriber
  Subscriber = Struct.new(:conn, :subject, :sid)

  class Server
    
    class << self
      attr_reader :id, :info, :log_time, :auth_required, :debug_flag, :trace_flag
      alias auth_required? :auth_required
      alias debug_flag? :debug_flag
      alias trace_flag? :trace_flag
 
      def version; "nats server version #{NATS::VERSION}" end

      def host; @options[:addr]  end
      def port; @options[:port]  end
      def pid_file; @options[:pid_file] end

      def setup(argv)
        @options = {}

        parser.parse!(argv)
        read_config_file
        finalize_options

        @id = fast_uuid
        @sublist = Sublist.new
        @info = {
          :nats_server_id => Server.id,
          :version => VERSION,
          :auth_required => auth_required?,
          :max_payload => MAX_PAYLOAD_SIZE
        }

        # Write pid file if need be.
        File.open(@options[:pid_file], 'w') { |f| f.puts "#{Process.pid}" } if @options[:pid_file]

        # Check for daemon flag
        if @options[:daemonize]
          require 'rubygems'
          require 'daemons'
          # These log messages visible to controlling TTY
          log "Starting #{NATS::APP_NAME} version #{NATS::VERSION} on port #{NATS::Server.port}"
          log "Switching to daemon mode"
          Daemons.daemonize(:app_name => APP_NAME, :mode => :exec)
        end

        setup_logs
      end
      
      def subscribe(subscriber)
{'fraction_non_alphanumeric': 0.11639762107051826, 'fraction_numerical': 0.0, 'mean_word_length': 2.560483870967742, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '1412073', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1084, 'n_words': 274}