# ErisML is a modeling layer for governed, foundation-model-enabled agents
# Copyright (c) 2025 Andrew H. Bond
# Contact: agi.hpc@gmail.com
#
# Licensed under the AGI-HPC Responsible AI License v1.0.
# You may obtain a copy of the License at the root of this repository,
# or by contacting the author(s).
#
# You may use, modify, and distribute this file for non-commercial
# research and educational purposes, subject to the conditions in
# the License. Commercial use, high-risk deployments, and autonomous
# operation in safety-critical domains require separate written
# permission and must include appropriate safety and governance controls.
#
# Unless required by applicable law or agreed to in writing, this
# software is provided "AS IS", without warranties or conditions
# of any kind. See the License for the specific language governing
# permissions and limitations.

from __future__ import annotations

import logging

from prometheus_client import Counter

logger = logging.getLogger("erisml")

NORM_VIOLATIONS = Counter(
    "erisml_norm_violations_total",
    "Total norm violations observed by ErisEngine",
)
STEPS = Counter(
    "erisml_steps_total",
    "Total simulation steps in ErisEngine",
)


def log_step(violated: bool) -> None:
    STEPS.inc()
    if violated:
        NORM_VIOLATIONS.inc()
    logger.info("step", extra={"norm_violated": violated})
