You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: file.go
    path of file: ./repos/teler/pkg/logs
    
    the code of the file until where you have to start completion: package logs

import (
	"encoding/json"
	"fmt"

	"github.com/kitabisa/teler/common"
)

// File write detected threats into it
func File(options *common.Options, data map[string]string) error {
	var out string
	file := options.Configs.Logs.File

	if options.Output != nil {
		if file.JSON {
			logJSON, err := json.Marshal(data)
			if err != nil {
				return err
			}
			out = fmt.Sprintf("%s\n", logJSON)
		} else {
			out = fmt.Sprintf("[%s] [%s] [%s] %s\n",
				data["time_local"],
				data["remote_addr"],
				data["cate
    
func File(options *common.Options, data map[string]string) error {
	var out string
	file := options.Configs.Logs.File

	if options.Output != nil {
		if file.JSON {
			logJSON, err := json.Marshal(data)
			if err != nil {
				return err
			}
			out = fmt.Sprintf("%s\n", logJSON)
		} else {
			out = fmt.Sprintf("[%s] [%s] [%s] %s\n",
				data["time_local"],
				data["remote_addr"],
				data["category"],
				data[data["element"]],
			)
		}

		if _, write := options.Output.WriteString(out); write != nil {
			return write
		}
	}

	return nil
}