<commit_before>package service

import (
	"context"
	"fmt"
	"time"

	"github.com/micro/go-micro/client"

	"github.com/micro/go-micro/debug/log"
	pb "github.com/micro/go-micro/debug/proto"
)

// Debug provides debug service client
type Debug struct {
	dbg pb.DebugService
}

// NewDebug provides Debug service implementation
func NewDebug(name string) *Debug {
	// create default client
	cli := client.DefaultClient

	return &Debug{
		dbg: pb.NewDebugService(name, cli),
	}
}

// Logs queries the service logs and returns a channel to read the logs from
func (d *Debug) Logs(opts ...log.ReadOption) (<-chan log.Record, error) {
	options := log.ReadOptions{}
	// initialize the read options
	for _, o := range opts {
		o(&options)
	}

	req := &pb.LogRequest{}
	if !options.Since.IsZero() {
		req.Since = options.Since.UnixNano()
	}

	if options.Count > 0 {
		req.Count = int64(options.Count)
	}

	req.Stream = options.Stream

	// get the log stream
	stream, err := d.dbg.Logs(context.Background(), req)
	if err != nil {
		return nil, fmt.Errorf("failed getting log stream: %s", err)
	}

	// log channel for streaming logs
	logChan := make(chan log.Record)
	// go stream logs
	go d.streamLogs(logChan, stream)

	return logChan, nil<commit_msg>Time resolution change to be in line with debug/handler.Handler<commit_after>package service

import (
	"context"
	"fmt"
	"time"

	"github.com/micro/go-micro/client"

	"github.com/micro/go-micro/debug/log"
	pb "github.com/micro/go-micro/debug/proto"
)

// Debug provides debug service client
type Debug struct {
	dbg pb.DebugService
}

// NewDebug provides Debug service implementation
func NewDebug(name string) *Debug {
	// create default client
	cli := client.DefaultClient

	return &Debug{
		dbg: pb.NewDebugService(name, cli),
	}
}

// Logs queries the service logs and returns a channel to read the logs from
func (d *Debug) Logs(opts ...log.ReadOption) (<-chan log.Record, error) {
	options := log.ReadOptions{}
	// initialize the read options
	for _, o := range opts {
		o(&options)
	}

	req := &pb.LogRequest{}
	if !options.Since.IsZero() {
		req.Since = options.Since.Unix()
	}

	if options.Count > 0 {
		req.Count = int64(options.Count)
	}

	req.Stream = options.Stream

	// get the log stream
	stream, err := d.dbg.Logs(context.Background(), req)
	if err != nil {
		return nil, fmt.Errorf("failed getting log stream: %s", err)
	}

	// log channel for streaming logs
	logChan := make(chan log.Record)
	// go stream logs
	go d.streamLogs(logChan, stream)

	return logChan, nil
{'fraction_non_alphanumeric': 0.13064133016627077, 'fraction_numerical': 0.0023752969121140144, 'mean_word_length': 3.602914389799636, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3360779', 'n_tokens_mistral': 899, 'n_tokens_neox': 850, 'n_words': 249}