<commit_before>(*
 * Copyright (C) 2006-2009 Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)
open Printf

let error fmt = Logs.error "general" fmt
let info fmt = Logs.info "general" fmt
let debug fmt = Logs.debug "general" fmt

let access_log_file = ref "/var/log/xenstored-access.log"
let access_log_nb_files = ref 20
let access_log_nb_lines = ref 13215
let activate_access_log = ref true

(* maximal size of the lines in xenstore-acces.log file *)
let line_size = 180

let log_read_ops = ref false
let log_transaction_ops = ref false
let log_special_ops = ref false

type access_type =
	| Coalesce
	| Conflict
	| Commit
	| Newconn
	| Endconn
	| XbOp of Xb.Op.operation

type access =
	{
		fd: out_channel ref;
		counter: int ref;
		write: tid:int -> con:string -> ?data:string -> access_type -> unit;
	}

let string_of_date () =
	let time = Unix.gettimeofday () in
	let tm = Unix.localtime time in
	let msec = time -. (floor time) in
	sprintf "%d%.2d%.2d %.2d:%.2d:%.2d.%.3d" (1900 + tm.Unix.tm_year)
		(tm.Unix.tm_mon + 1)
		tm.Unix.tm_mday
		tm.Unix.tm_hour
		tm.Unix.tm_min
		tm.Unix.tm_sec
		(int_of_float (1000.0 *. msec))

let fill_with_space n s =
	if String.length s < n
	then <commit_msg>[oxenstored] Use iso8601-like string format and GMT timezone in xenstored-access.log<commit_after>(*
 * Copyright (C) 2006-2009 Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)
open Printf

let error fmt = Logs.error "general" fmt
let info fmt = Logs.info "general" fmt
let debug fmt = Logs.debug "general" fmt

let access_log_file = ref "/var/log/xenstored-access.log"
let access_log_nb_files = ref 20
let access_log_nb_lines = ref 13215
let activate_access_log = ref true

(* maximal size of the lines in xenstore-acces.log file *)
let line_size = 180

let log_read_ops = ref false
let log_transaction_ops = ref false
let log_special_ops = ref false

type access_type =
	| Coalesce
	| Conflict
	| Commit
	| Newconn
	| Endconn
	| XbOp of Xb.Op.operation

type access =
	{
		fd: out_channel ref;
		counter: int ref;
		write: tid:int -> con:string -> ?data:string -> access_type -> unit;
	}

let string_of_date () =
	let time = Unix.gettimeofday () in
	let tm = Unix.gmtime time in
	let msec = time -. (floor time) in
	sprintf "%d%.2d%.2dT%.2d:%.2d:%.2d.%.3dZ" (1900 + tm.Unix.tm_year)
		(tm.Unix.tm_mon + 1)
		tm.Unix.tm_mday
		tm.Unix.tm_hour
		tm.Unix.tm_min
		tm.Unix.tm_sec
		(int_of_float (1000.0 *. msec))

let fill_with_space n s =
	if String.length s < n
	then 
{'fraction_non_alphanumeric': 0.090595340811044, 'fraction_numerical': 0.02185792349726776, 'mean_word_length': 3.68733153638814, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2102950', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1177, 'n_words': 430}