# log_appendix(::Type{SesOperator}) = "_SesOp";
log_appendix(::SesOperator) = "_SesOp";
# log_appendix(::Type{SesNbOperator})= "_NbOp";
log_appendix(::SesNbOperator)= "_NbOp";



function init_log_file(::AbstractSesCell, location::String = default_log_location, name::String = "", init_policy = tb_overwrite)
    td = today();
    n = now();
    s = second(n);
    m = minute(n);
    h = hour(n);
    log_name = name * "_$(td)_$(h)h$(m)m$(s)s";
    log_path = joinpath(location, log_name);
    return TBLogger(log_path, init_policy), log_name;
end



function _log_value(logger::TBLogger, name::AbstractString, value; group::AbstractString = "")
    value_name = if isempty(group) name else "$group/$name" end;
    log_value(logger, value_name, value);
end



function logging(operator::SesOperator,
                 logger = TBLogger(default_log_location, tb_overwrite),
                 group = "", appendix = "", index::Integer = 1)
    _log_value(logger, "AlphaProxy$appendix", operator.alpha_proxy[index], group = group);
    _log_value(logger, "Alpha$appendix", Ses.alpha(operator)[index], group = group);
end
function logging(operator::SesNbOperator,
                 logger = TBLogger(default_log_location, tb_overwrite),
                 group = "", appendix = "", index::Integer = 1)
    _log_value(logger, "AlphaProxy$appendix", operator.alpha_proxy[index], group = group);
    _log_value(logger, "Alpha$appendix", Ses.alpha(operator)[index], group = group);
    _log_value(logger, "ThetaProxy$appendix", operator.theta_proxy[index], group = group);
    _log_value(logger, "Theta$appendix", Ses.theta(operator)[index], group = group);
end