Logger

logger.def

unit logger;

from string import String;
from io import IO;
from time import Time, Timestamp;

module Logger {
    proc info(msg: String) {
        @affect IO.stdout(msg)

        @modify msg {
            use timestamp;
        }

        @spawn timestamp: Timestamp {
            let now = Time.get_now_time();
            return now;
        }
    }

    proc error(msg: String) {
        @affect IO.stdout(msg)

        @modify msg {
            use timestamp;
        }

        @spawn timestamp: Timestamp {
            let now = Time.get_now_time();
            return now;
        }
    }
}

string.def

unit string;

data String {}

io.def

unit io;

module IO {
    proc stdout(msg: String) {}
}

time.def

unit time;

data Timestamp {}

module Time {
    func get_now_time() -> Timestamp {
        @return now
        @spawn now: Timestamp
    }
}