How to catch stdout per module?

If I want to run unrelated tasks and output stdout over the network how would I capture stdout in a module without another module stealing it?

As I see it there is only one Base.stdout, which is the default for println. As a backup there is also Core.stdout, but I think this should not be touched. How would one implement println per module to use a module owned stdout.

module A
const stdout = redirect_stdout()
print() = println("Mod A")
end
module B
const stdout = redirect_stdout()
print() = println("Mod B")
end
A.print()
B.print()
readline(A.stdout[1])
# is empty
readline(B.stdout[1])
# Mod A
readline(A.stdout[1])
# Mod B

Another idea is writing to a file and overwriting print functions, but maybe there is a more elegant way.

module A
    const out = mktemp()
    print(txt) = Base.print(out[2],txt)
    function generate()
        print("test1")
        println("test2")
        @show a=3
    end
    function get()
        seek(out[2],0)
        read(out[2],String)    
    end
    println(txt) = Base.println(out[2],txt)
end
A.generate()
# a = 3 = 3
# 3
A.get()
# "test1test2\n"