<commit_before>// Copyright 2017 The nvim-go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package log

import (
	"fmt"
	"log"
	"os"
)

var (
	logger      = log.New(os.Stderr, "", log.Lshortfile)
	debug       = os.Getenv("NVIM_GO_DEBUG")
	debugLogger = log.New(os.Stderr, "DEBUG: ", log.Lshortfile)
)

func Print(v ...interface{}) {
	logger.Output(2, fmt.Sprint(v...))
}

func Printf(format string, v ...interface{}) {
	logger.Output(2, fmt.Sprintf(format, v...))
}

func Println(v ...interface{}) {
	logger.Output(2, fmt.Sprintln(v...))
}

func Fatal(v ...interface{}) {
	logger.Output(2, "FATAL: "+fmt.Sprint(v...))
	os.Exit(1)
}

func Fatalf(format string, v ...interface{}) {
	logger.Output(2, "FATAL: "+fmt.Sprintf(format, v...))
	os.Exit(1)
}

func Fatalln(v ...interface{}) {
	logger.Output(2, "FATAL: "+fmt.Sprintln(v...))
	os.Exit(1)
}

func Panic(v ...interface{}) {
	s := fmt.Sprint(v...)
	logger.Output(2, "PANIC: "+s)
	panic(s)
}

func Panicf(format string, v ...interface{}) {
	s := fmt.Sprintf(format, v...)
	logger.Output(2, "PANIC: "+s)
	panic(s)
}

func Panicln(v ...interface{}) {
	s := fmt.Sprintln(v...)
	logger.Output(2, "PANIC: "+s)
	panic(s)
}

func Debug(v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, fmt.Sprint(v...))
}

func Debugf(format string, v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, fmt.Sprintf(format, v...))
}

func Debugln(v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, fmt.Sprintln(v...))
}<commit_msg>internal/log: add DebugDump function<commit_after>// Copyright 2017 The nvim-go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package log

import (
	"fmt"
	"log"
	"os"

	"github.com/davecgh/go-spew/spew"
)

var (
	logger      = log.New(os.Stderr, "", log.Lshortfile)
	debug       = os.Getenv("NVIM_GO_DEBUG")
	debugLogger = log.New(os.Stderr, "DEBUG: ", log.Lshortfile)
)

func Print(v ...interface{}) {
	logger.Output(2, fmt.Sprint(v...))
}

func Printf(format string, v ...interface{}) {
	logger.Output(2, fmt.Sprintf(format, v...))
}

func Println(v ...interface{}) {
	logger.Output(2, fmt.Sprintln(v...))
}

func Fatal(v ...interface{}) {
	logger.Output(2, "FATAL: "+fmt.Sprint(v...))
	os.Exit(1)
}

func Fatalf(format string, v ...interface{}) {
	logger.Output(2, "FATAL: "+fmt.Sprintf(format, v...))
	os.Exit(1)
}

func Fatalln(v ...interface{}) {
	logger.Output(2, "FATAL: "+fmt.Sprintln(v...))
	os.Exit(1)
}

func Panic(v ...interface{}) {
	s := fmt.Sprint(v...)
	logger.Output(2, "PANIC: "+s)
	panic(s)
}

func Panicf(format string, v ...interface{}) {
	s := fmt.Sprintf(format, v...)
	logger.Output(2, "PANIC: "+s)
	panic(s)
}

func Panicln(v ...interface{}) {
	s := fmt.Sprintln(v...)
	logger.Output(2, "PANIC: "+s)
	panic(s)
}

func Debug(v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, fmt.Sprint(v...))
}

func Debugf(format string, v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, fmt.Sprintf(format, v...))
}

func Debugln(v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, fmt.Sprintln(v...))
}

func DebugDump(v ...interface{}) {
	if len(debug) == 0 {
		return
	}
	debugLogger.Output(2, spew.Sdump(v...))
}
{'fraction_non_alphanumeric': 0.21461988304093568, 'fraction_numerical': 0.013450292397660818, 'mean_word_length': 3.335868187579214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3928928', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1375, 'n_words': 305}