##! Internal functions and types used by the logging framework.

module Log;

%%{
#include "zeek/logging/Manager.h"
%%}

type Filter: record;
type Stream: record;
type RotationInfo: record;
type RotationFmtInfo: record;

enum PrintLogType %{
	REDIRECT_NONE,
	REDIRECT_STDOUT,
	REDIRECT_ALL,
%}

function Log::__create_stream%(id: Log::ID, stream: Log::Stream%) : bool
	%{
	bool result = zeek::log_mgr->CreateStream(id->AsEnumVal(), stream->AsRecordVal());
	return zeek::val_mgr->Bool(result);
	%}

function Log::__remove_stream%(id: Log::ID%) : bool
	%{
	bool result = zeek::log_mgr->RemoveStream(id->AsEnumVal());
	return zeek::val_mgr->Bool(result);
	%}

function Log::__enable_stream%(id: Log::ID%) : bool
	%{
	bool result = zeek::log_mgr->EnableStream(id->AsEnumVal());
	return zeek::val_mgr->Bool(result);
	%}

function Log::__disable_stream%(id: Log::ID%) : bool
	%{
	bool result = zeek::log_mgr->DisableStream(id->AsEnumVal());
	return zeek::val_mgr->Bool(result);
	%}

function Log::__add_filter%(id: Log::ID, filter: Log::Filter%) : bool
	%{
	bool result = zeek::log_mgr->AddFilter(id->AsEnumVal(), filter->AsRecordVal());
	return zeek::val_mgr->Bool(result);
	%}

function Log::__remove_filter%(id: Log::ID, name: string%) : bool
	%{
	bool result = zeek::log_mgr->RemoveFilter(id->AsEnumVal(), name);
	return zeek::val_mgr->Bool(result);
	%}

function Log::__write%(id: Log::ID, columns: any%) : bool
	%{
	bool result = zeek::log_mgr->Write(id->AsEnumVal(), columns->AsRecordVal());
	return zeek::val_mgr->Bool(result);
	%}

function Log::__set_buf%(id: Log::ID, buffered: bool%): bool
	%{
	bool result = zeek::log_mgr->SetBuf(id->AsEnumVal(), buffered);
	return zeek::val_mgr->Bool(result);
	%}

function Log::__flush%(id: Log::ID%): bool
	%{
	bool result = zeek::log_mgr->Flush(id->AsEnumVal());
	return zeek::val_mgr->Bool(result);
	%}
