<commit_before>package log

import (
	"errors"
	"fmt"
	"github.com/astaxie/beego/logs"
)

func Prepare() error {
	progressLog = new(logs.BeeLogger)
	return nil
}

func LoadConsole(cfg Config) (err error) {
	err = progressLog.SetLogger(adapterConsole, cfg.ToJson())
	if err != nil {
		err = errors.New("load console error when set logger:" + err.Error())
		return
	}
	// 日志总开关
	progressLog.SetLevel(LevelDebug)
	err = progressLog.DelLogger(logs.AdapterConsole)
	if err != nil {
		err = errors.New("load console error when del logger:" + err.Error())
	}
	return
}

func LoadFileLogger(cfg Config) (err error) {
	if len(cfg.Filename) > 0 {
		err = progressLog.SetLogger(logs.AdapterFile, cfg.ToJson())
		if err != nil {
			err = fmt.Errorf("set file logger error:%v", err)
		}
	}

	if !cfg.EnableStdout {
		if dErr := progressLog.DelLogger(adapterConsole); dErr != nil {
			WarningF("disable stdout error:%v", dErr)
		}
	}
	return
}<commit_msg>print log file<commit_after>package log

import (
	"errors"
	"fmt"
	"github.com/astaxie/beego/logs"
)

func Prepare() error {
	progressLog = new(logs.BeeLogger)
	return nil
}

func LoadConsole(cfg Config) (err error) {
	err = progressLog.SetLogger(adapterConsole, cfg.ToJson())
	if err != nil {
		err = errors.New("load console error when set logger:" + err.Error())
		return
	}
	// 日志总开关
	progressLog.SetLevel(LevelDebug)
	err = progressLog.DelLogger(logs.AdapterConsole)
	if err != nil {
		err = errors.New("load console error when del logger:" + err.Error())
	}
	return
}

func LoadFileLogger(cfg Config) (err error) {
	if len(cfg.Filename) > 0 {
		err = progressLog.SetLogger(logs.AdapterFile, cfg.ToJson())
		if err != nil {
			err = fmt.Errorf("set file logger error:%v", err)
		}
		DebugF("log file:%s", cfg.Filename)
	}

	if !cfg.EnableStdout {
		if dErr := progressLog.DelLogger(adapterConsole); dErr != nil {
			WarningF("disable stdout error:%v", dErr)
		}
	}
	return
}
{'fraction_non_alphanumeric': 0.1415929203539823, 'fraction_numerical': 0.001041124414367517, 'mean_word_length': 4.071240105540897, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4980445', 'n_tokens_mistral': 720, 'n_tokens_neox': 693, 'n_words': 167}