# Creating a custom log message categorie

**URL:** <https://discourse.julialang.org/t/creating-a-custom-log-message-categorie/29295>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 29, 2019, 3:23pm UTC](https://discourse.julialang.org/t/creating-a-custom-log-message-categorie/29295 "2019-09-29T15:23:32Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Daryl-Gregory](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daryl-gregory/32/29010_2.png) [@Daryl-Gregory](https://discourse.julialang.org/u/Daryl-Gregory)\
**Post date:** [September 10, 2021, 4:54am UTC](https://discourse.julialang.org/t/creating-a-custom-log-message-categorie/29295/21 "2021-09-10T04:54:27Z")

</div>

I also got this error with 1.6. I worked around it by extending handle\_message. At top of file imported the function:

`import Base.CoreLogging.handle_message`

My custom level struct is this:

```julia
struct CustomLevel
    level::Int32
    name::String
end

```

```julia
handle_message(logger::SimpleLogger, level::CustomLevel, message, _module, group, id, filepath, line; kwargs...) =
    handle_message_custom(logger, level, message, _module, group, id, filepath, line; kwargs...)

```

handle\_message\_custom() is mostly a copy and paste of Base.corelogging.handle\_message, with one line change:

`levelstr = level == Warn ? "Warning" : string(level)`  
changed to  
`levelstr = level.name`

[Previous page](https://discourse.julialang.org/t/creating-a-custom-log-message-categorie/29295.md?page=1)
