<commit_before>// Package vlog add leveled log on std log(golang.org/pkg/log/)
// It implements most std log functions(except logger), variables
// and add provides V-style logging controlled by the -v flag or SetLogLevel()
// If flag.Parse be called before any logging, -v flag(default 0) use automaticlly.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Basic examples:
//  vlog.SetLogLevel(3)
//  vlog.GetLogLevel()
//
//	vlog.Println("Prepare to repel boarders")
//
//	vlog.Fatalf("Initialization failed: %s", err)
//
// See the documentation for the V function for an explanation of these examples:
//
//	if vlog.V(2) {
//		vlog.Print("Starting transaction...")
//	}
//
//	vlog.V(2).Println("Processed", nItems, "elements")
package vlog

import (
	"flag"
	"fmt"
	"io"
	"log"
	"os"
)

// These flags define which text to prefix to each log entry generated by the Logger.
const (
	// Bits or'ed together to control what's printed.
	// There is no control over the order they appear (the order listed
	// here) or the format they present (as described in the comments).
	// The prefix is followed by a colon only when Llongfile or Lshortfile
	// is specified.
	// For example, flags Ldate | Ltime (or LstdFlags) produce,
	//	2009/01/23 01:23:23 message
	// while flags Ldate | Ltime | Lmicroseconds | Llongfile produce,
	//	2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
	Ldate         = log.Ldate             // the date in the local time zone: 2009/01/23
	Ltime         = log.Ltime             // the time in the local time zone: 01:23:23
	Lmicroseconds = log.Lmicroseconds     // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile     = log.Llongfile         // full file name and line number: /a/b/c/d.go:23
	Lshortfile    = log.Lshortfile        // final file name element and line number: d.go:23. overrides Llongfile
	LUTC          = log.LUTC              // if Ldate or Ltime is set, use UTC rather than the local time zone
	LstdFlags     = log.Ldate | log.Ltime // initial values for the standard logger
)

var (
	level uint

	std = log.New(os.Stderr, "", LstdFlags)
)

// Verbose is a boolean type that implements Print like function.
// See the documentation of V for more information.
type Verbose bool

func init() {
	flag.UintVar(&level, "v", 0, "log level for V logs")
}

// Set log level, just use at parameter initialize zone.
func SetLogLevel(v uint) {
	level = v
}

// Get log level, just use at parameter initialize zone.
func GetLogLevel() uint {
	return level
}

// Whether an individual call to V generates a log record depends on the setting of level.
func V(v uint) Verbose {
	if v <= level {
		return true
	}
	return false
}

func (vb Verbose) Printf(format string, v ...interface{}) {
	if vb {
		std.Output(2, fmt.Sprintf(format, v...))
	}
}

func (vb Verbose) Println(v ...interface{}) {
	if vb {
		std.Output(2, fmt.Sprintln(v...))
	}
}

func (vb Verbose) Print(v ...interface{}) {
	if vb {
		std.Output(2, fmt.Sprint(v...))
	}
}<commit_msg>change level type uint to int<commit_after>// Package vlog add leveled log on std log(golang.org/pkg/log/)
// It implements most std log functions(except logger), variables
// and add provides V-style logging controlled by the -v flag or SetLogLevel()
// If flag.Parse be called before any logging, -v flag(default 0) use automaticlly.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Basic examples:
//  vlog.SetLogLevel(3)
//  vlog.GetLogLevel()
//
//	vlog.Println("Prepare to repel boarders")
//
//	vlog.Fatalf("Initialization failed: %s", err)
//
// See the documentation for the V function for an explanation of these examples:
//
//	if vlog.V(2) {
//		vlog.Print("Starting transaction...")
//	}
//
//	vlog.V(2).Println("Processed", nItems, "elements")
package vlog

import (
	"flag"
	"fmt"
	"io"
	"log"
	"os"
)

// These flags define which text to prefix to each log entry generated by the Logger.
const (
	// Bits or'ed together to control what's printed.
	// There is no control over the order they appear (the order listed
	// here) or the format they present (as described in the comments).
	// The prefix is followed by a colon only when Llongfile or Lshortfile
	// is specified.
	// For example, flags Ldate | Ltime (or LstdFlags) produce,
	//	2009/01/23 01:23:23 message
	// while flags Ldate | Ltime | Lmicroseconds | Llongfile produce,
	//	2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
	Ldate         = log.Ldate             // the date in the local time zone: 2009/01/23
	Ltime         = log.Ltime             // the time in the local time zone: 01:23:23
	Lmicroseconds = log.Lmicroseconds     // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile     = log.Llongfile         // full file name and line number: /a/b/c/d.go:23
	Lshortfile    = log.Lshortfile        // final file name element and line number: d.go:23. overrides Llongfile
	LUTC          = log.LUTC              // if Ldate or Ltime is set, use UTC rather than the local time zone
	LstdFlags     = log.Ldate | log.Ltime // initial values for the standard logger
)

var (
	level int

	std = log.New(os.Stderr, "", LstdFlags)
)

// Verbose is a boolean type that implements Print like function.
// See the documentation of V for more information.
type Verbose bool

func init() {
	flag.IntVar(&level, "v", 0, "log level for V logs")
}

// Set log level, just use at parameter initialize zone.
func SetLogLevel(v int) {
	level = v
}

// Get log level, just use at parameter initialize zone.
func GetLogLevel() int {
	return level
}

// Whether an individual call to V generates a log record depends on the setting of level.
func V(v int) Verbose {
	if v <= level {
		return true
	}
	return false
}

func (vb Verbose) Printf(format string, v ...interface{}) {
	if vb {
		std.Output(2, fmt.Sprintf(format, v...))
	}
}

func (vb Verbose) Println(v ...interface{}) {
	if vb {
		std.Output(2, fmt.Sprintln(v...))
	}
}

func (vb Verbose) Print(v ...interface{}) {
	if vb {
		std.Output(2, fmt.Sprint(v...))
	}
}
{'fraction_non_alphanumeric': 0.1156530408773679, 'fraction_numerical': 0.022219057114371173, 'mean_word_length': 2.9272930648769573, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3028846', 'n_tokens_mistral': 2334, 'n_tokens_neox': 2220, 'n_words': 877}