Skip to content

Commit a2d9193

Browse files
authored
Merge pull request #13 from JuliaLogging/tan/misc
handle Function type being logged as JSON message
2 parents e7e053f + da086a2 commit a2d9193

File tree

6 files changed

+80
-84
lines changed

6 files changed

+80
-84
lines changed

.appveyor.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/TagBot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
jobs:
8+
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: JuliaRegistries/TagBot@v1
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
tags: ["*"]
6+
pull_request:
7+
jobs:
8+
test:
9+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
version:
15+
- '1.2'
16+
- '1' # automatically expands to the latest stable 1.x release of Julia
17+
- nightly
18+
os:
19+
- ubuntu-latest
20+
arch:
21+
- x64
22+
- x86
23+
include:
24+
# test macOS and Windows with latest Julia only
25+
- os: macOS-latest
26+
arch: x64
27+
version: 1
28+
- os: windows-latest
29+
arch: x64
30+
version: 1
31+
- os: windows-latest
32+
arch: x86
33+
version: 1
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: julia-actions/setup-julia@v1
37+
with:
38+
version: ${{ matrix.version }}
39+
arch: ${{ matrix.arch }}
40+
- uses: actions/cache@v1
41+
env:
42+
cache-name: cache-artifacts
43+
with:
44+
path: ~/.julia/artifacts
45+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
46+
restore-keys: |
47+
${{ runner.os }}-test-${{ env.cache-name }}-
48+
${{ runner.os }}-test-
49+
${{ runner.os }}-
50+
- uses: julia-actions/julia-buildpkg@v1
51+
- uses: julia-actions/julia-runtest@v1
52+
- uses: julia-actions/julia-processcoverage@v1
53+
- uses: codecov/codecov-action@v1
54+
with:
55+
file: lcov.info

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ uuid = "c41e01d8-14e5-11ea-185b-e7eabed7be4b"
33
keywords = ["log", "rotate", "roller", "logrotate"]
44
license = "MIT"
55
authors = ["Tanmay Mohapatra <[email protected]>"]
6-
version = "0.4.2"
6+
version = "0.4.3"
77

88
[compat]
9-
julia = "1.2,1.3,1.4,1.5"
9+
julia = "1.2"
1010
CodecZlib = "0.6,0.7"
1111
JSON = "0.21"
1212

src/log_utils.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ Handles Module types for now, more can be added later.
44
"""
55
struct LogEntrySerialization <: CommonSerialization end
66

7-
show_json(io::StructuralContext, ::LogEntrySerialization, m::Module) = show_json(io, LogEntrySerialization(), string(m))
8-
show_json(io::StructuralContext, ::LogEntrySerialization, ptr::Ptr) = show_json(io, LogEntrySerialization(), string(ptr))
9-
show_json(io::StructuralContext, ::LogEntrySerialization, sv::Core.SimpleVector) = show_json(io, LogEntrySerialization(), [sv...])
10-
show_json(io::StructuralContext, ::LogEntrySerialization, typ::DataType) = show_json(io, LogEntrySerialization(), string(typ))
7+
show_json(io::StructuralContext, ser::LogEntrySerialization, m::Function) = show_json(io, ser, string(m))
8+
show_json(io::StructuralContext, ser::LogEntrySerialization, m::Module) = show_json(io, ser, string(m))
9+
show_json(io::StructuralContext, ser::LogEntrySerialization, ptr::Ptr) = show_json(io, ser, string(ptr))
10+
show_json(io::StructuralContext, ser::LogEntrySerialization, sv::Core.SimpleVector) = show_json(io, ser, [sv...])
11+
show_json(io::StructuralContext, ser::LogEntrySerialization, typ::DataType) = show_json(io, ser, string(typ))
1112

12-
function show_json(io::StructuralContext, ::LogEntrySerialization, level::Logging.LogLevel)
13+
function show_json(io::StructuralContext, ser::LogEntrySerialization, level::Logging.LogLevel)
1314
levelstr = (level == Logging.Debug) ? "Debug" :
1415
(level == Logging.Info) ? "Info" :
1516
(level == Logging.Warn) ? "Warn" :
1617
(level == Logging.Error) ? "Error" :
1718
"LogLevel($(level.level))"
18-
show_json(io, LogEntrySerialization(), levelstr)
19+
show_json(io, ser, levelstr)
1920
end
2021

21-
function show_json(io::StructuralContext, ::LogEntrySerialization, exception::Tuple{Exception,Any})
22+
function show_json(io::StructuralContext, ser::LogEntrySerialization, exception::Tuple{Exception,Any})
2223
iob = IOBuffer()
2324
Base.show_exception_stack(iob, [exception])
24-
show_json(io, LogEntrySerialization(), String(take!(iob)))
25+
show_json(io, ser, String(take!(iob)))
2526
end
2627

2728
as_text(str::String) = str

0 commit comments

Comments
 (0)