Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mnt: Update batches #2

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Ryan Price <[email protected]>
<!-- badges: start -->
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/loggit)](https://cran.r-project.org/package=loggit)
[![Monthly downloads](https://cranlogs.r-pkg.org/badges/loggit)](https://cran.r-project.org/package=loggit)
[![Support me on Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/ryapric)
[![R-CMD-check](https://github.com/MEO265/loggit_private/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MEO265/loggit_private/actions/workflows/R-CMD-check.yaml)
[![codecov.io](https://codecov.io/gh/MEO265/loggit_private/branch/main/graphs/badge.svg)](https://app.codecov.io/gh/MEO265/loggit_private?branch=main)
<!-- badges: end -->

------------------------------------------------------------------------
Expand Down
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ Ryan Price <[email protected]>

<!-- badges: start -->

[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/loggit)](https://cran.r-project.org/package=loggit)
[![R-CMD-check](https://github.com/ryapric/loggit/workflows/R-CMD-check/badge.svg)](https://github.com/ryapric/loggit/actions)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/loggit)](https://cran.r-project.org/package=loggit)
[![Monthly
downloads](https://cranlogs.r-pkg.org/badges/loggit)](https://cran.r-project.org/package=loggit)
[![Support me on
Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/ryapric)
[![R-CMD-check](https://github.com/MEO265/loggit_private/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MEO265/loggit_private/actions/workflows/R-CMD-check.yaml)
[![codecov.io](https://codecov.io/gh/MEO265/loggit_private/branch/main/graphs/badge.svg)](https://app.codecov.io/gh/MEO265/loggit_private?branch=main)
<!-- badges: end -->

-----
------------------------------------------------------------------------

`loggit` is an [`ndJSON`](https://github.com/ndjson/ndjson-spec) logging
library for R software. It is blazingly fast when writing logs, and has
Expand All @@ -28,19 +27,18 @@ for the Getting Started guide, as well as some other use case examples.
There are indeed several logging packages available for R. `loggit`,
however, takes a more modern approach approach to logging in R:

- Opting to use the JSON format, which is parsable by most modern
software
- Designed with log streams in mind
- Unobtrusive, yet highly flexible
- Convenient ability to log data, then analyze that log data on the
same host.
- Opting to use the JSON format, which is parsable by most modern
software
- Designed with log streams in mind
- Unobtrusive, yet highly flexible
- Convenient ability to log data, then analyze that log data on the same
host.

Additionally, the boilerplate to get going with `loggit` is minimal at
worst, only requiring you to point to the log file. If deploying your R
code in a container ecosystem, you don’t even need to do that, since
`loggit` will echo its formatted logs to `stdout`. No need to write
custom formatters, handlers, levels, etc. – ***just f\&ck\#n’
loggit\!***
custom formatters, handlers, levels, etc. – ***just f&ck#n’ loggit!***

## Quick Examples

Expand All @@ -51,18 +49,19 @@ otherwise, logs will print to the console, but land in a tempfile.

``` r
library(loggit)
#> Warning: Paket 'loggit' wurde unter R Version 4.1.3 erstellt
#>
#> Attaching package: 'loggit'
#> The following objects are masked from 'package:base':
#> Attache Paket: 'loggit'
#> Die folgenden Objekte sind maskiert von 'package:base':
#>
#> message, stop, warning
# set_logfile("./loggit.log")

message("This is a message")
#> {"timestamp": "2022-04-12T10:55:02-0500", "log_lvl": "INFO", "log_msg": "This is a message"}
#> {"timestamp": "2023-12-19T10:01:28+0100", "log_lvl": "INFO", "log_msg": "This is a message"}
#> This is a message
warning("This is a warning")
#> {"timestamp": "2022-04-12T10:55:02-0500", "log_lvl": "WARN", "log_msg": "This is a warning"}
#> {"timestamp": "2023-12-19T10:01:28+0100", "log_lvl": "WARN", "log_msg": "This is a warning"}
#> Warning in warning("This is a warning"): This is a warning
# stop("This actually throws a critical error, so I'm not actually going to run it here :)"))
#> {"timestamp": "2020-05-31T20:59:33-0500", "log_lvl": "ERROR", "log_msg": "This actually throws a critical error, so I'm not actually going to run it here :)"}
Expand All @@ -81,15 +80,15 @@ log.

``` r
loggit("ERROR", "This will log an error - but not actually throw one yet", rows = nrow(iris), anything_else = "you want to include")
#> {"timestamp": "2022-04-12T10:55:02-0500", "log_lvl": "ERROR", "log_msg": "This will log an error - but not actually throw one yet", "rows": "150", "anything_else": "you want to include"}
#> {"timestamp": "2023-12-19T10:01:28+0100", "log_lvl": "ERROR", "log_msg": "This will log an error - but not actually throw one yet", "rows": "150", "anything_else": "you want to include"}

# Read log file into data frame to implement logic based on entries
logdata <- read_logs()
print(logdata)
#> timestamp log_lvl
#> 1 2022-04-12T10:55:02-0500 INFO
#> 2 2022-04-12T10:55:02-0500 WARN
#> 3 2022-04-12T10:55:02-0500 ERROR
#> 1 2023-12-19T10:01:28+0100 INFO
#> 2 2023-12-19T10:01:28+0100 WARN
#> 3 2023-12-19T10:01:28+0100 ERROR
#> log_msg rows
#> 1 This is a message
#> 2 This is a warning
Expand All @@ -106,7 +105,7 @@ if (any(logdata$log_lvl == "ERROR")) {

Again, [check out the
vignettes](https://cran.r-project.org/web/packages/loggit/vignettes/)
for more details\!
for more details!

## Installation

Expand Down
Loading