<commit_before>package clients

import (
	"context"
	"fmt"

	"cloud.google.com/go/logging"
	"google.golang.org/api/option"
)

// Logger exported
type Logger struct {
	client *logging.Client
	logger *logging.Logger
}

// NewLogger initializes and return a Logger struct
func NewLogger(ctx context.Context, authFile string) (*Logger, error) {
	projectName, loggerName := "pedro-audit", "my-default-logger"

	logging.EntryCountThreshold(0)
	c, err := logging.NewClient(ctx, projectName, option.WithCredentialsFile(authFile))
	if err != nil {
		return nil, fmt.Errorf("failed to init logger: %q", err)
	}

	if err := c.Ping(ctx); err != nil {
		return nil, fmt.Errorf("failed to pings logger: %q", err)
	}

	l := c.Logger(loggerName)

	return &Logger{client: c, logger: l}, nil
}

//Info push info log to buffer
func (l *Logger) Info(message string, a ...interface{}) {

	l.logger.Log(logging.Entry{Payload: fmt.Sprintf(message, a...), Severity: logging.Info})
}

//Warning push warning log to buffer
func (l *Logger) Warning(message string, a ...interface{}) {

	l.logger.Log(logging.Entry{Payload: fmt.Sprintf(message, a...), Severity: logging.Warning})<commit_msg>retrieving project id from env<commit_after>package clients

import (
	"context"
	"fmt"
	"os"

	"cloud.google.com/go/logging"
	"google.golang.org/api/option"
)

// Logger exported
type Logger struct {
	client *logging.Client
	logger *logging.Logger
}

var projectID = os.Getenv("GCP_PROJECT")

// NewLogger initializes and return a Logger struct
func NewLogger(ctx context.Context, authFile string) (*Logger, error) {
	loggerName := "my-default-logger"

	logging.EntryCountThreshold(0)
	c, err := logging.NewClient(ctx, projectID, option.WithCredentialsFile(authFile))
	if err != nil {
		return nil, fmt.Errorf("failed to init logger: %q", err)
	}

	if err := c.Ping(ctx); err != nil {
		return nil, fmt.Errorf("failed to pings logger: %q", err)
	}

	l := c.Logger(loggerName)

	return &Logger{client: c, logger: l}, nil
}

//Info push info log to buffer
func (l *Logger) Info(message string, a ...interface{}) {

	l.logger.Log(logging.Entry{Payload: fmt.Sprintf(message, a...), Severity: logging.Info})
}

//Warning push warning log to buffer
func (l *Logger) Warning(message string, a ...interface{}) {

	l.logger.Log(logging.Entry{Payload: fmt.Sprintf(message, a...), Severity: logging.Warning})
{'fraction_non_alphanumeric': 0.1495129182549767, 'fraction_numerical': 0.0008470986869970351, 'mean_word_length': 4.442396313364055, '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': '3901016', 'n_tokens_mistral': 799, 'n_tokens_neox': 774, 'n_words': 221}