diff --git a/lib/c/docs/api.md b/lib/c/docs/api.md index fe2e3e4dbf5398c64fb8738feedd5aac6647a4ca..828e8d3404a45dd20e9d92b3e49baca49e83eb60 100644 --- a/lib/c/docs/api.md +++ b/lib/c/docs/api.md @@ -111,7 +111,7 @@ catClientInitWithConfig("ccat", &config); Disable the `ccat`, shutdown `sender`, `monitor` and `aggregator` threads. -Also release all the resources that have been used. +And then release all the resources that have been used. ```c int catClientDestroy(); diff --git a/lib/cpp/docs/api.md b/lib/cpp/docs/api.md index 72a145a8db9ab3a7cd57b13522f2ed52b92bb709..c44c3f9a2397905046ce4d1874f230a6a818419e 100644 --- a/lib/cpp/docs/api.md +++ b/lib/cpp/docs/api.md @@ -64,7 +64,7 @@ int main() { ## API list -All the `cppcat` apis are in the `cat` namespace. +All the `cppcat` APIs are in the `cat` namespace. ### Common apis @@ -84,7 +84,7 @@ Following config is used by default. * `enableMultiprocessing` is false. * `enableDebugLog` is false. -You can also customize config. (Like to use text encoder instead of binary encoder) +You can also customize config. (Like to use text encoder instead of the binary encoder) ```cpp cat::Config c = cat::Config(); @@ -97,7 +97,7 @@ cat::init("cppcat", c); Disable the cat client, shutdown `sender`, `monitor` and `aggregator` threads. -Also release all the resources that have been used. +And then release all the resources that have been used. ```cpp void destroy(); diff --git a/lib/java/README.md b/lib/java/README.md index 7119efdbd56dc58b5bbaac490fc5fa4ca06ac468..ac7050edc23b88247c7ebfbce3d5c27b403c3cee 100644 --- a/lib/java/README.md +++ b/lib/java/README.md @@ -1,6 +1,6 @@ -# Cat Client Java +# Cat Client for Java -[中文文档](./doc/zh-CN.md) +[中文文档](./README.zh-CN.md) The java cat client supports JDK 1.6+ @@ -28,11 +28,11 @@ app.name={appkey} > Only English characters (a-z, A-Z), numbers (0-9), underscore (\_) and dash (-) is allowed in appkey. -Due to java cat client will be lazy initialized, it's not necessary to initialize it manually. +Due to java cat client will be lazily initialized, it's not necessary to initialize it manually. ## Quickstart -``` +```java Transaction t = Cat.newTransaction("URL", "pageName"); try { @@ -51,13 +51,13 @@ try { } ``` -## Api List +## API List ### Transaction -> To avoid of forgetting to complete the Transaction, it's better to surround the Transaction by a try-catch-finally block. +> To avoid forgetting to complete the Transaction, it's better to surround the Transaction by a try-catch-finally block. -``` +```java Transaction t = Cat.newTransaction("URL", "pageName"); try { @@ -82,7 +82,7 @@ We offered a series of APIs to modify the Transaction. These APIs can be easily used with the following codes. -``` +```java Transaction t = Cat.newTransaction("URL", "pageName"); try { @@ -124,15 +124,15 @@ Log an error with error stack info. Error is a special event, the type of it depend on the class of the given `Throwable e`. -1. If `e` is an instanceof `Error`, the `type` will be set to `Error` -2. Else if `e` is an instanceof `RuntimeException`, the `type` will be set to `RuntimeException` +1. If `e` is an instanceof `Error`, the `type` will be set to `Error`. +2. Else if `e` is an instanceof `RuntimeException`, the `type` will be set to `RuntimeException`. 3. The `type` will be set to `Exception` in the other cases. `name` will be set to the `e.getClass().getName()` by default. And the stack info will be built and set to `data`. -``` +```java try { 1 / 0; } catch (Exception e) { @@ -142,17 +142,13 @@ try { You can append your own error message to the top of the stack info like this: -``` -try { - 1 / 0; -} catch (Exception e) { - Cat.logError("error(X) := exception(X)", e); -} +```java +Cat.logError("error(X) := exception(X)", e); ``` #### Cat.logErrorWithCategory -Though `name` has been set to the classname of the given `throwable e` by default, you can use this api to overwrite it. +Though `name` has been set to the classname of the given `throwable e` by default, you can use this API to overwrite it. ```java Exception e = new Exception("syntax error"); @@ -168,7 +164,7 @@ Cat.logErrorWithCategory("custom-category", "?- X = Y, Y = 2", e); ### Metric -``` +```java # Counter Cat.logMetricForCount("metric.key"); Cat.logMetricForCount("metric.key", 3); @@ -177,24 +173,24 @@ Cat.logMetricForCount("metric.key", 3); Cat.logMetricForDuration("metric.key", 5); ``` -We do aggregate every seconds. +We do aggregate every second. -For example, if you have called count 3 times in one second (with the same name), we will just summarised the value of them and reported once to the server. +For example, if you have called count 3 times in one second (with the same name), we will just summarise the value of them and reported once to the server. -In case of `duration`, we use `averaged` value instead of `summarised` value. +In the case of `duration`, we use `averaged` value instead of `summarised` value. ## Integration ### Log component integration -[log4j](../../integration/log4j/README.md) -[log4j2](../../integration/log4j2/README.md) -[logback](../../integration/logback/README.md) +* [log4j](../../integration/log4j/README.md) +* [log4j2](../../integration/log4j2/README.md) +* [logback](../../integration/logback/README.md) ### URL monitoring integration -[URL monitoring integration with web.xml](../../integration/URL/README.md) -[URL monitoring integration with springboot](../../integration/spring-boot/README.md) +* [URL monitoring integration with web.xml](../../integration/URL/README.md) +* [URL monitoring integration with springboot](../../integration/spring-boot/README.md) ### Other integration solutions diff --git a/lib/java/doc/zh-CN.md b/lib/java/README.zh-CN.md similarity index 99% rename from lib/java/doc/zh-CN.md rename to lib/java/README.zh-CN.md index 70733c342660d93b974423eaa18ae0efe6f8b14f..2ebedd661a45bb8caa5e70f618728a69807d342c 100644 --- a/lib/java/doc/zh-CN.md +++ b/lib/java/README.zh-CN.md @@ -47,7 +47,7 @@ try { } ``` -## Api List +## API List ### Transaction @@ -161,7 +161,7 @@ Cat.logErrorWithCategory("custom-category", "?- X = Y, Y = 2", e); 记录业务指标的总和或平均值。 -``` +```java # Counter Cat.logMetricForCount("metric.key"); Cat.logMetricForCount("metric.key", 3); diff --git a/lib/python/README.md b/lib/python/README.md index 2c75dc627afc67f1e3f79fe9f7ac5d5fdd93d7fe..1b330f960ae0e58f283038967f40d43c8d40e7e9 100644 --- a/lib/python/README.md +++ b/lib/python/README.md @@ -32,9 +32,9 @@ cat.init("appkey") ### Coroutine Mode -Since we are using `ThreadLocal` to storage the transaction stack in `ccat`, which is neccessary to build the `message tree`, and `pycat` is highly dependent on `ccat`. (with cffi) +Since we are using `ThreadLocal` to storage the transaction stack in `ccat`, which is necessary to build the `message tree`, and `pycat` is highly dependent on `ccat`. (with cffi) -So we don't support message tree in `coroutine` modes, like `gevent`, `greenlet` because different coroutines that in the same thread run alternately. +So we don't support message tree in `coroutine` modes, like `gevent`, `greenlet` because of different coroutines that in the same thread run alternately. In these cases, you should use the following code to initialize `pycat`. @@ -64,7 +64,7 @@ cat.init("appkey", encoder=cat.ENCODER_TEXT) Sometimes you may want to enable the debug log. -Note the logs will be outputed to `console`. +Note the logs will be outputted to `console`. ```python cat.init("appkey", debug=True) @@ -93,7 +93,7 @@ with cat.Transaction("foo", "bar") as t: time.sleep(1) ``` -## Api List +## API List ### Transaction @@ -102,13 +102,13 @@ t = cat.Transaction("Trans", "t3") t.complete() ``` -To avoid of forgetting to complete the transaction, we strongly recommend you to surround the transaction by a `try-finally` block, and complete the transaction in the `finally` code block. +To avoid forgetting to complete the transaction, we strongly recommend you to surround the transaction by a `try-finally` block and complete the transaction in the `finally` code block. ```python try: - t = cat.Transaction("Trans", "t3") + t = cat.Transaction("Trans", "t3") finally: - t.complete() + t.complete() ``` We also provide `decorator` and `context manager` usages, which can complete the transaction automatically. @@ -126,9 +126,9 @@ def test(): cat.log_event("Event", "E2") ``` -If something goes wrong in the decorated function, the status of the transaction will be set to `FAILED`, and whatever the function raised a exception or not, the transaction will be auto-completed. +If something goes wrong in the decorated function, the status of the transaction will be set to `FAILED`, and whatever the function raised an exception or not, the transaction will be auto-completed. -The only problem is that you can't get the transaction object if you monitor a function via decorator. +The only problem is that you can't get the transaction object if you monitor a function via a decorator. #### via context manager @@ -142,7 +142,7 @@ with cat.Transaction("Transaction", "T1") as t: t.add_data("hello world!") ``` -If something goes wrong in the `with` context, the status of the transaction will be set to `FAILED`, and whatever the code block raised a exception or not, the transaction will be auto-completed. +If something goes wrong in the `with` context, the status of the transaction will be set to `FAILED`, and whatever the code block raised an exception or not, the transaction will be auto-completed. Though it is a bit complex, you can get the transaction object :) @@ -256,8 +256,8 @@ cat.metric("metric1").count(5) cat.metric("metric2").duration(100) ``` -We do aggregate every seconds. +We do aggregate every second. -For example, if you have called count 3 times in one second (with the same name), we will just summarised the value of them and report once to the server. +For example, if you have called count 3 times in one second (with the same name), we will just summarise the value of them and report once to the server. -In case of `duration`, we use `averaged` value instead of `summarised` value. +In the case of `duration`, we use `averaged` value instead of `summarised` value. diff --git a/lib/python/README.zh-CN.md b/lib/python/README.zh-CN.md index 50bb3cedf677821e6940dcdb18446ca43f875ba7..44a30089edaaa9b9fcd514959c707201d2f45a75 100644 --- a/lib/python/README.zh-CN.md +++ b/lib/python/README.zh-CN.md @@ -91,7 +91,7 @@ with cat.Transaction("foo", "bar") as t: time.sleep(1) ``` -## Api List +## API List ### Transaction