invenia / Memento.jl

A flexible logging library for Julia
https://invenia.github.io/Memento.jl/latest
Other
88 stars 14 forks source link

getfilters problem #65

Closed Qiyamah closed 6 years ago

Qiyamah commented 6 years ago

I am writing my own treehandler

    using Memento
    using DataStructures
    using ...Trace.IOUtils
    using ...Trace.TraceRecord

    export TreeHandler

    mutable struct TreeHandler{F,O} <: Handler{F,O}
        decorated::DefaultHandler{F,O}
        iostack::Stack
        nlstack::Stack
        levels #stupid memento design
        function TreeHandler(io::O, fmt::F=DefaultFormatter(), opts=Dict{Symbol, Any}())  where {F<:Formatter, O<:IO}
            dh = DefaultHandler(io,fmt,opts)
            const this = new{F,O}(dh,Stack(IOState),Stack(NLState),dh.levels)
            push!(this.iostack,output_state(io))
            this
        end 
    end

    function Memento.Filter(h::TreeHandler)
        Memento.Filter(h.decorated)
    end

    function Memento.getfilters(decorator::TreeHandler)
        Memento.getfilters(decorator.decorated)
    end

    function Base.push!(decorator::TreeHandler, filter::Memento.Filter)
        push!(decorator.decorated,filter)
    end

    function Memento.setlevel!(decorator::TreeHandler, level::AbstractString)
        Memento.setlevel!(decorator.decorated,level)
    end

it gives me the following error:

ERROR: LoadError: LoadError: LoadError: UndefVarError: getfilters not defined
Stacktrace:
 [1] include_from_node1(::String) at ./loading.jl:576
 [2] include(::String) at ./sysimg.jl:14
 [3] include_from_node1(::String) at ./loading.jl:576
 [4] include(::String) at ./sysimg.jl:14
 [5] include_from_node1(::String) at ./loading.jl:576
 [6] eval(::Module, ::Any) at ./boot.jl:235
 [7] _require(::Symbol) at ./loading.jl:490
 [8] require(::Symbol) at ./loading.jl:405
rofinn commented 6 years ago

That's weird because when I run that code on julia 0.6.2 and Memento 0.6.0 it works (apart from the Trace module not defined). Is it erroring when you're calling a specific function or is this in a module that you're loading somewhere?

Qiyamah commented 6 years ago

Thanks for the reply, i think my memento was outdated. Once i updated it, everything was solved. Thanks