Skip to content

Commit da9484f

Browse files
authored
Merge pull request #240 from jonocarroll/main
Add ntfy appender
2 parents 662228d + 24c7c7f commit da9484f

18 files changed

+93
-6
lines changed

DESCRIPTION

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
Type: Package
22
Package: logger
33
Title: A Lightweight, Modern and Flexible Logging Utility
4-
Version: 0.4.1.9000
5-
Date: 2025-09-09
4+
Version: 0.4.1.9001
5+
Date: 2025-10-29
66
Authors@R: c(
77
person("Gergely", "Daróczi", , "[email protected]", role = c("aut", "cre"),
88
comment = c(ORCID = "0000-0003-3149-8537")),
99
person("Hadley", "Wickham", , "[email protected]", role = "aut",
1010
comment = c(ORCID = "0000-0003-4757-117X")),
11+
person("Jonathan", "Carroll", , "[email protected]", role = "ctb",
12+
comment = c(ORCID = "0000-0002-1404-5264")),
1113
person("Spare Cores", role = "fnd"),
1214
person("System1", role = "fnd")
1315
)
@@ -31,6 +33,7 @@ Suggests:
3133
jsonlite,
3234
knitr,
3335
mirai (>= 1.3.0),
36+
ntfy,
3437
pander,
3538
parallel,
3639
R.utils,
@@ -54,4 +57,4 @@ Config/testthat/edition: 3
5457
Config/testthat/parallel: TRUE
5558
Encoding: UTF-8
5659
Roxygen: list(markdown = TRUE)
57-
RoxygenNote: 7.3.2
60+
RoxygenNote: 7.3.3

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export(appender_async)
1818
export(appender_console)
1919
export(appender_file)
2020
export(appender_kinesis)
21+
export(appender_ntfy)
2122
export(appender_pushbullet)
2223
export(appender_slack)
2324
export(appender_stderr)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# logger 0.4.1.9000 (development version)
22

3+
New features and quality of life improvements:
4+
5+
* Added `appender_ntfy()` to use {ntfy} as an appender (#240, @jonocarroll)
6+
37
# logger 0.4.1 (2025-09-08)
48

59
New features and quality of life improvements:

R/appenders.R

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,34 @@ appender_pushbullet <- function(...) {
232232
}
233233

234234

235+
#' Send log messages to ntfy
236+
#' @param title notification title
237+
#' @param tags emoji (or general tag) for notification. See [ntfy::emoji]
238+
#' @param ... extra parameters passed to [ntfy::ntfy_send] such as
239+
#' `priority`, `topic`, etc.
240+
#' @details Configure server and topic via environment variables. See
241+
#' [ntfy::ntfy_topic()] for details
242+
#' @export
243+
#' @note This functionality depends on the \pkg{ntfy} package.
244+
#' @family log_appenders
245+
#' @export
246+
appender_ntfy <- function(title = "{logger}",
247+
tags = c("memo"),
248+
...) {
249+
fail_on_missing_package("ntfy")
250+
force(title)
251+
force(tags)
252+
253+
structure(
254+
function(lines) {
255+
ntfy::ntfy_send(title = title, tags = tags, message = paste(lines, sep = "\n"), ...)
256+
},
257+
generator = deparse(match.call())
258+
)
259+
}
260+
261+
262+
235263
#' Send log messages to a Telegram chat
236264
#' @param chat_id Unique identifier for the target chat or username of
237265
#' the target channel (in the format @channelusername)

man/appender_async.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/appender_console.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/appender_file.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/appender_kinesis.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/appender_ntfy.Rd

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/appender_pushbullet.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)