# A simple append-only logger canister

**URL:** <https://forum.dfinity.org/t/a-simple-append-only-logger-canister/10408>\
**Category:** Programs & Applications\
**Created:** [January 21, 2022, 8:42am UTC](https://forum.dfinity.org/t/a-simple-append-only-logger-canister/10408 "2022-01-21T08:42:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [January 21, 2022, 8:42am UTC](https://forum.dfinity.org/t/a-simple-append-only-logger-canister/10408/1 "2022-01-21T08:42:46Z")

</div>

If you are looking for a simple, ready-to-use logger solution, you can try this out:

> **[GitHub - ninegua/ic-logger: Motoko library to help create an append-only...](https://github.com/ninegua/ic-logger)**
>
> Motoko library to help create an append-only logger actor - GitHub - ninegua/ic-logger: Motoko library to help create an append-only logger actor

You can either use it as a Motoko module, or use the example text based logger actor to deploy your own logger canister. It offers a single `append` method to keep track of logs. Logs are put into buckets, and new buckets will be created when old ones become full.

The only other notable administrative method is removing the oldest buckets. All logs are indexed by a line number and can be downloaded to local for offline analysis. Removing buckets does not affect the index.

It can be extended to support “block-chained” logs, i.e. log entries that keep a hash of their parent log entry, which then can be used to prove its immutable history has not been tampered with. But I’ve no use of such functionality, so I don’t see myself implementing it any time soon.

Anyway, just a little tool that can be handy to keep track of events. I’m using it in my other project [Canister Tip Jar](https://forum.dfinity.org/t/worry-about-your-favorate-canister-running-low-on-cycles-you-got-it-covered/10307).

---

<div class="post-metadata">

**Author:** ![coin\_master](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/coin_master/32/15963_2.png) [@coin\_master](https://forum.dfinity.org/u/coin_master)\
**Post date:** [February 19, 2022, 5:58am UTC](https://forum.dfinity.org/t/a-simple-append-only-logger-canister/10408/2 "2022-02-19T05:58:13Z")

</div>

I there a similar solution in Rust?  
I would be so grateful if there’s already a solution in Rust instead of trying to implement it myself.

---

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [February 20, 2022, 2:57am UTC](https://forum.dfinity.org/t/a-simple-append-only-logger-canister/10408/3 "2022-02-20T02:57:55Z")

</div>

There is [an example](https://github.com/ninegua/ic-logger/tree/main/example) in the repo that deploys a standalone canister. Then you can just call it from your rust canister. Works 100%.

---

<div class="post-metadata">

**Author:** ![coin\_master](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/coin_master/32/15963_2.png) [@coin\_master](https://forum.dfinity.org/u/coin_master)\
**Post date:** [February 20, 2022, 4:20am UTC](https://forum.dfinity.org/t/a-simple-append-only-logger-canister/10408/4 "2022-02-20T04:20:51Z")

</div>

Thanks I will give it a try
